题解 | #计算用户的平均次日留存率#
计算用户的平均次日留存率
https://www.nowcoder.com/practice/126083961ae0415fbde061d7ebbde453
select count(distinct t1.device_id,t1.date,t2.date)/count(distinct t1.device_id,t1.date) avg_ret from question_practice_detail t1 left join question_practice_detail t2 on t1.device_id=t2.device_id and datediff(t2.date,t1.date)= 1