对SQL中已有字段进行逐行累加
例如对下表中的credit_amount进行逐行累加
SELECT t.credit_amount from table t;
修改为:
SELECT t.credit_amount ,
SUM(t.credit_amount) OVER (ORDER BY t.credit_source_num) total_amout
--以credit_source_num为维度进行汇总
from table t;
对SQL中已有字段进行逐行累加
例如对下表中的credit_amount进行逐行累加
SELECT t.credit_amount from table t;
修改为:
SELECT t.credit_amount ,
SUM(t.credit_amount) OVER (ORDER BY t.credit_source_num) total_amout
--以credit_source_num为维度进行汇总
from table t;