题解 | #2021年11月每天新用户的次日留存率#
https://www.nowcoder.com/practice/1fc0e75f07434ef5ba4f1fb2aa83a450
select V.t, round(count(U.uid) / count(V.uid), 2) from ( ( select uid, min(date(in_time)) t from tb_user_log group by uid ) as V left join ( select uid, date(in_time) t from tb_user_log union select uid, date(out_time) t from tb_user_log ) as U on V.uid = U.uid and V.t = date_sub(U.t, INTERVAL 1 DAY) ) where date_format(V.t, "%Y-%m") = '2021-11' group by V.t