题解 | #牛客每个人最近的登录日期(四)#
牛客每个人最近的登录日期(四)
http://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
select `date`,count(case when `date`=first_date then `date` else null end)as new
from login b inner join (
select user_id,min(date)as first_date
from login
group by user_id)a on a.user_id=b.user_id
group by `date`