日期:2014-05-17 浏览次数:20738 次
with tb as(
select 1 as a from dual union all
select 2 from dual union all
select 3 from dual union all
select 4 from dual union all
select 5 from dual
)
select a.a,sum(b.a) from tb a,tb b where a.a>=b.a
group by a.a
order by a.a
with t as
(
select 1 c1 from dual union all
select 2 c1 from dual union all
select 3 c1 from dual union all
select 4 c1 from dual union all
select 5 c1 from dual
)
select c1,sum(c1) over(order by rownum) tl
from t
c1 tl
-----------------------
1 1 1
2 2 3
3 3 6
4 4 10
5 5 15