题解 | #每天的日活数及新用户占比#

每天的日活数及新用户占比

https://www.nowcoder.com/practice/dbbc9b03794a48f6b34f1131b1a903eb

select date,any_value(active_cnt) dau
,round(count(distinct uid)/any_value(active_cnt),2) uv_new_ratio from 
(
select min(date(in_time)) min_date ,uid
from tb_user_log
group by uid
) a right join 
(
select date,count(distinct uid) active_cnt
from (
select date(out_time) date,uid
from tb_user_log
union
select date(in_time) date,uid
from tb_user_log) s1
group by date
) b
on a.min_date = b.date
group by date
order by date;

全部评论

相关推荐

05-09 13:22
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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