Jan Flikweert
Programmer
Hi all,
Of course there are different ways to calculate a ongoing 7-day sum/average.
I never had a way to use a query. Now I found the way:
Kind regards,
Jan Flikweert
Of course there are different ways to calculate a ongoing 7-day sum/average.
I never had a way to use a query. Now I found the way:
Code:
***First create a cursor with unique date value
SELECT distinct dt FROM riooldata WHERE EMPTY(dt)=.f. INTO CURSOR unique_data READWRITE
***Then create cursor with ongoin 7-days sum
SELECT unique_data.dt,SUM(riooldata.rnaml)/100000000000 AS sum_rnaml, 100 AS indx FROM covid19!riooldata;
[COLOR=#CC0000]JOIN unique_data ON riooldata.dt BETWEEN unique_data.dt-6 AND unique_data.dt[/color] WHERE unique_data.dt>=DATE(YEAR(DATE()),1,1) GROUP BY 1 ORDER BY 1 INTO CURSOR Sum_7days READWRITE
Kind regards,
Jan Flikweert