蜂巢中的滚动不同计数

时间:2018-08-21 06:51:07

标签: hive count distinct hiveql

以下查询返回当天的不重复计数。但是,我想进行几天的滚动计数。

//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);

您能帮助我查询返回滚动计数的问题吗?

0 个答案:

没有答案
相关问题