题解 | #牛客每个人最近的登录日期(六)#
牛客每个人最近的登录日期(六)
http://www.nowcoder.com/practice/572a027e52804c058e1f8b0c5e8a65b4
一看到组内累计求和就考虑用开窗函数
select u.name u_n,date,sum(number) over(partition by user_id order by date) ps_num
from passing_number p left join user u on p.user_id=u.id
order by date,u_n;