I am working on query to get cumulative distinct count of uids on daily basis.
Example : Say there are 2 uids (100,200) appeared on date 2016-11-01 and they also appea
You can use exists
to check if an id was present on any of the previous dates. Then get the running sum and find the max value for each group which would get you the daily distinct cumulative count.
select dt, max(col) as daily_cumulative_count
from (select t1.*,
sum(case when not exists (select 1 from t where t1.dt > dt and id = t1.uid) then 1 else 0 end) over(order by dt) col
from t t1) x
group by dt