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

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

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

select t2.dt,(allnum+if(num2 is not null,num2,0)) dau,round(if(xin is not null,xin,0)/(allnum+if(num2 is not null,num2,0)),2) uv_new_ratio from
(select date(in_time) dt,count(distinct uid) allnum
from tb_user_log
group by date(in_time)) as t2
left join 
(select date(time1) dt,count(1) xin
from(
select distinct uid,min(in_time) time1
from tb_user_log
group by uid) as t1
group by date(time1)) as t3
on t2.dt = t3.dt
left join
(select date(out_time) dt,count(distinct uid) num2
from tb_user_log
where timestampdiff(day,date(in_time),date(out_time)) = 1
group by date(out_time)) as t4
on t2.dt = t4.dt

全部评论

相关推荐

程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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