select start_month, 
    count(distinct uid) as mau,
    sum(new) as month_add_uv, 
    max(sum(new)) over(order by start_month) as max_monthe_add_uv, 
    sum(sum(new)) over(order by start_month) as cum_sum_uv
from (
    select *, date_format(start_time,'%Y%m') as start_month, 
    if(start_time = min(start_time) over(partition by uid), 1, 0) as new
    from exam_record
    ) as a 
group by start_month
order by start_month
子查询