题解 | MYsql 开窗函数#牛客每个人最近的登录日期(三)#
牛客每个人最近的登录日期(四)
http://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
select
date,sum(case when date=d then 1 else 0 end)
from
(select * ,min(date) over(partition by user_id) d from login) as a
group by date
order by date