题解 | #每天的日活数及新用户占比#
每天的日活数及新用户占比
http://www.nowcoder.com/practice/dbbc9b03794a48f6b34f1131b1a903eb
select t.dt, count(t.uid) dau, round(count(if(t.dt=t1.first_time,1,null)) / count(t.uid),2) uv_new_ratio from(select uid, date(in_time) dt from tb_user_log union select uid, date(out_time) dt from tb_user_log)t left join (select uid,date(min(in_time)) first_time from tb_user_log group by uid) t1 on t1.uid = t.uid group by t.dt