Hi,
if you have "2 days preceeding" task, then you can actually switch to fixed size windows.
First do a subquery to get one row per day, grouping by "responsedt" column, and summing up the "score" and "n" columns.
Then, if you need to fill the missing dates, then add an outer join with a full calendar. That is, if you don't have data for say 2013-09-01 - then the question is - "2 days preceeding" mean 2013-08-30 and 2013-08-31, OR only 2013-08-31 and NULLs for missing 2013-09-01.
Then, use simple fixed-length windows functions - ROWS BETWEEN 2 PRECEEDING AND CURRENT ROW.
Hope this helps. Please let me know if you find a better solution.:)
Regards,
Vlad.
Hi,
if you have "2 days preceeding" task, then you can actually switch to fixed size windows.
First do a subquery to get one row per day, grouping by "responsedt" column, and summing up the "score" and "n" columns.
Then, if you need to fill the missing dates, then add an outer join with a full calendar. That is, if you don't have data for say 2013-09-01 - then the question is - "2 days preceeding" mean 2013-08-30 and 2013-08-31, OR only 2013-08-31 and NULLs for missing 2013-09-01.
Then, use simple fixed-length windows functions - ROWS BETWEEN 2 PRECEEDING AND CURRENT ROW.
Hope this helps. Please let me know if you find a better solution.:)
Regards,
Vlad.