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

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

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

#当创建时间和当前时间相同,就是新增用户 select date(dt),count(),round(sum(if(dt=min_time,1,0))/count(),2) from ( #解决跨天问题用union select uid,date(in_time) dt from tb_user_log union select uid,date(out_time) dt from tb_user_log )t1 join ( #求每个uid的创建时间 select uid,min(date(in_time)) min_time from tb_user_log group by uid )t2 on t1.uid = t2.uid group by date(dt) order by date(dt);

全部评论

相关推荐

纸鹰:对他说:“你好,我是百度JAVA。”
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务