题解 | #每月及截止当月的答题情况#

每月及截止当月的答题情况

https://www.nowcoder.com/practice/1ce93d5cec5c4243930fc5e8efaaca1e

select start_month,count(distinct uid) as mau,
sum(new_day) as month_add_uv,
max(sum(new_day)) over(order by start_month) as max_month_add_uv,
sum(sum(new_day)) 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_day from exam_record) as t1
group by start_month

先统计一下每个月新出现的人数new_day,然后使用窗口函数进行统计,

全部评论

相关推荐

用户64975461947315:这不很正常吗,2个月开实习证明,这个薪资也还算合理,深圳Java好多150不包吃不包住呢,而且也提前和你说了没有转正机会,现在贼多牛马公司骗你说毕业转正,你辛辛苦苦干了半年拿到毕业证,后面和你说没hc了😂
点赞 评论 收藏
分享
03-27 17:33
门头沟学院 Java
代码飞升:同学院本,你要注意hr当天有没有回复过,早上投,还要打招呼要推销自己,不要一个劲投
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务