1. 累加
力扣534:
关键点:
sum(games_played) over(partition by player_id order by event_date)
--滑动累加求和,指向性明显,用sum()...over()...窗口函数。
注:order by 后省略 rows between,默认rows between unbounded preceding and current row;
order by, rows between 均省略,默认 rows between unbounded preceding and unbounded following。
题解:
select player_id,event_date, sum(games_played) over(partition by player_id order by event_date) as games_played_so_far from Activity order by player_id,event_date desc
-END
标签:rows,窗口,函数,order,player,between,id,综训,event From: https://www.cnblogs.com/peitongshi/p/16942592.html