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; 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章