22,209
社区成员
发帖
与我相关
我的任务
分享
--oracle写法,呵呵
select *,debitsum = sum(debit) over(partition by acounnt,acctname,year,month order by row_num)
from tb a
select *,debitsum = (select convert(decimal(15,2),sum(debit)) from tb where a.acounnt = acounnt and a.acctname = acctname and a.year = year and a.month = month and row_num <= a.row_num)
from tb a