题解 | #牛客每个人最近的登录日期(四)#
牛客每个人最近的登录日期(四)
https://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
select
distinct
t1.date
,if(isnull(table2.cnt),0,table2.cnt) new
from
login t1 left join
(
select
date
,count(*) cnt
from
(
select
min(date) date
from login
group by user_id
)table1
group by 1
)table2
on t1.date = table2.date

