题解 | #牛客每个人最近的登录日期(四)#
牛客每个人最近的登录日期(四)
https://www.nowcoder.com/practice/e524dc7450234395aa21c75303a42b0a
-- 窗口 函数实现方法 select t1.date, sum(case when t1.rk = 1 then 1 else 0 end) as new from ( select user_id, date, row_number() over ( partition by user_id order by date ) as rk from login group by user_id, date ) as t1 group by date;