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

平均活跃天数和月活人数

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

select month,round(sum(num)/count(uid),2) as avg_active_days,count(uid) as mau
from(
select month,uid,count(distinct date(start_time)) num
from(
select *,date_format(date(start_time),'%Y%m') as month
from exam_record
where score != '(NULL)'
and left(start_time,4) = '2021') as t1
group by month,uid) as t2
group by month

先计算每月每个用户的活跃次数

再计算别的

全部评论

相关推荐

点赞 评论 收藏
分享
04-11 21:31
四川大学 Java
野猪不是猪🐗:(ja)va学弟这招太狠了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务