17,086
社区成员
发帖
与我相关
我的任务
分享
SQL> with table1 as(
2 select 1 id, 43 num from dual
3 union all
4 select 2, 3 from dual
5 union all
6 select 3, 33 from dual
7 union all
8 select 4, 2 from dual
9 union all
10 select 5, -7 from dual
11 )
12 select id,num,sum(num)over(order by id) from table1
13 /
ID NUM SUM(NUM)OVER(ORDERBYID)
---------- ---------- -----------------------
1 43 43
2 3 46
3 33 79
4 2 81
5 -7 74
SQL>