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

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

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

with t1 as(SELECT DISTINCT uid,DATE(in_time) AS dt FROM tb_user_log
UNION
SELECT DISTINCT uid,DATE(out_time) AS dt FROM tb_user_log)
select first,round(count(dt)/count(uid),2) from (select t2.uid,first,dt from (select uid,min(dt) as first from t1 group by uid) t2 left join t1 on t1.uid=t2.uid and datediff(t1.dt,t2.first)=1 )t3 where first like '2021-11%' group by first order by first

全部评论

相关推荐

09-28 22:01
已编辑
广西科技大学 IT技术支持
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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