题解 | 每月及截止当月的答题情况
select
*,
max(month_add_uv) over (
order by
start_month
) max_month_add_uv,
sum(month_add_uv) over (
order by
start_month
) cum_sum_uv
from
(
select
start_month,
count(distinct uid) mau,
sum(判断是否为新增用户) month_add_uv
from
(
select
*,
date_format (start_time, '%Y%m') start_month,
if (
min(start_time) over (
partition by
uid
order by
start_time
) = start_time,
1,
0
) 判断是否为新增用户
from
test.exam_record
) a
group by
start_month
) b
格力公司福利 357人发布