题解 | #网易云音乐推荐(网易校招笔试真题)#
牛客每个人最近的登录日期(三)
http://www.nowcoder.com/practice/16d41af206cd4066a06a3a0aa585ad3d
select round(count(t2.user_id)/count(t1.user_id),3)
from
(select user_id,min(date) first_date from login group by user_id) t1
left join
login t2
on t1.user_id = t2.user_id and date_add(t1.first_date,interval 1 day)=t2.date
;