以下查询返回当天的不重复计数。但是,我想进行几天的滚动计数。
//returns distinct count per day
SELECT data_dt day, COUNT(distinct id) as Subs
FROM table where data_dt between 20160801 and 20160805 group by data_dt;
//this query is not returning the rolling distinct count (failing in hive)
select day, sum(Subs) over (order by day) as Users from (
SELECT data_dt day, COUNT(distinct id) as Subs
FROM table where data_dt between 20160801 and 20160805 group by data_dt);
您能帮助我查询返回滚动计数的问题吗?