题解 | #牛客每个人最近的登录日期(四)#
牛客每个人最近的登录日期(四)
https://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
SELECT ddate.date2, case when elogin.mindate is not NULL then count(*) else 0 end from (SELECT distinct(date) date2 from login) ddate left join (Select user_id, Min(date) mindate from login group by user_id) elogin on ddate.date2 = elogin.mindate group by ddate.date2