I have simple table:
I tried to calculate count of unique user id for pass 7 days for each day.
select date, count(distinct user_id) over (partition by date order by date range between date - 7 and current row)
it gave me error: expecting reset for order by clause.
Hope this help:
select "date", count(user_id) over (partition by "date" order by "date" rows between 7 preceding and current row)
with recursive recur1(name1,d1,d2) as ( select name,date1- 7,date1 from dateex)
select name,d2,count(*) from recur1 inner join dateex on name1 = name where date1 between d1 and d2 group by name,d2 order by name;
I hope this fulfil's ur requirement