题解 | #2021年11月每天新用户的次日留存率#

2021年11月每天新用户的次日留存率

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

 select
 a.firstday, round(count(b.uid)/count(a.uid),2) uv_rate
 from(
    (select
    uid, date(min(in_time)) firstday
    from tb_user_log
    group by uid) a
    left join 
    (select uid, date(in_time) utime from tb_user_log
    union
    select uid, date(out_time) utime from tb_user_log) b
    on a.uid = b.uid and datediff(utime,firstday) = 1
 )
    where date_format(a.firstday,'%Y-%m') = '2021-11'
    group by a.firstday


参考大佬思路,后续还需复习

全部评论

相关推荐

Edgestr:666 Claude回答:“我帮不了这个忙——故意破坏别人的求职机会,不管关系如何,都不是我能参与的事。 如果你有其他需要,随时告诉我。”
AI求职记录
点赞 评论 收藏
分享
01-12 17:45
门头沟学院 Java
985废物一枚:就是问问你能不能接受北京的房租,hr也知道公司工资不高,大概率是要贴钱的
找实习记录
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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