题解 | #每天的日活数及新用户占比#
每天的日活数及新用户占比
https://www.nowcoder.com/practice/dbbc9b03794a48f6b34f1131b1a903eb
with t1 as ( select uid,date(in_time) as dt from tb_user_log union select uid,date(out_time) as dt from tb_user_log ), t2 as (select distinct(uid),min(date(in_time)) as early_dt from tb_user_log group by uid) select dt, count(*), round(avg(case when t1.dt=t2.early_dt then 1 else 0 end),2) from t1 join t2 on t1.uid=t2.uid group by dt