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

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

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

with zb4 as(with zb2 as (select uid,date_format(start_time,'%Y%m') start_month,start_time,first_value(start_time)
over(partition by uid order by start_time) zc_time
from exam_record)
select start_month,count(distinct uid) mau,sum(if(start_time=zc_time,1,0)) month_add_uv
from zb2
group by start_month
)
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 zb4
order by start_month

全部评论

相关推荐

06-15 18:44
黄淮学院 Java
Lynn012:如果是居民楼还是算了吧,看着有点野呢
点赞 评论 收藏
分享
每晚夜里独自颤抖:要求太多的没必要理
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-03 17:37
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务