题解 | 牛客每个人最近的登录日期(四)
牛客每个人最近的登录日期(四)
https://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
with t as (select
user_id,
min(date) as first_day
from login
group by user_id)
select
l.date,
count(t.user_id)
from login l
left join t
on l.user_id = t.user_id
and l.date = t.first_day
group by date
order by date asc;
