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

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

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

with tmp as (select uid,date(in_time) dt from tb_user_log
union 
select uid,date(out_time) dt from tb_user_log)

select 
    mdt,
    round(sum(if(datediff(dt,mdt)=1,1,0))/count(distinct uid),2)
from (select distinct uid,dt,
    min(dt) over(partition by uid) mdt
from  tmp) p 
where left(mdt,7) = '2021-11' group by  mdt  

靠 根本不会 抄别人的。。。

全部评论

相关推荐

学历算污点吗?
小何和:快毕业了,BOSS上的od闻着味就来了
点赞 评论 收藏
分享
喜欢核冬天的哈基米很想上市:会爆NullPointerException的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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