题解 | 平均活跃天数和月活人数

平均活跃天数和月活人数

https://www.nowcoder.com/practice/9e2fb674b58b4f60ac765b7a37dde1b9

with t0 as(select distinct date_format(start_time,'%Y%m') as month,uid,date_format(submit_time,'%Y-%m-%d') as dt from exam_record where score is not null order by 1)

select month,round(count(dt)/count(distinct case when dt is not null then uid end),2) as avg_active_days,count(distinct case when dt is not null then uid end) as mau from t0 where month like '2021%' group by 1

全部评论

相关推荐

牛客74464229...:年底就这样,招人的要不是很缺人的,要不就是岗位要求高的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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