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