sql 逐行累加

sql 逐行累加,包括当前行

select name,sl,
sum(sl) over(partition by name order by name rows between unbounded preceding and current row) as accumulate
from test;

 


 

 

 

可以实现在窗口中进行逐行累加

select uid,month,amount,
sum(amount) over(partition by uid order by month rows between unbounded preceding and current row) as accumulate
from t_access_tmp; 

 

posted @ 2023-04-07 17:25  superstar  阅读(601)  评论(0编辑  收藏  举报