题解 | #牛客每个人最近的登录日期(六)#
牛客每个人最近的登录日期(六)
https://www.nowcoder.com/practice/572a027e52804c058e1f8b0c5e8a65b4
with temp_table as ( SELECT user_id,date, SUM(number)over(PARTITION BY user_id ORDER BY date) as ps_num FROM passing_number ), temp_table_1 as ( select p.user_id as u_n,p.date,t.ps_num from passing_number p ,temp_table t where p.user_id =t.user_id and p.date = t.date ) select u.name as u_n ,tp1.date ,tp1.ps_num from temp_table_1 tp1,user u where tp1.u_n =u.id order by tp1.date,u.name