Oracle行结果合计的实现,主要应用于日期结果的集计,下面是具体的实现代码。
With AA as (
select 'A' tNo , 10 B from dual
union
select 'B' , 20 from dual
union
select 'A' , 30 from dual
)
select tNo , sum(B) over (partition by B order by B rows unbounded preceding) sumsal from AA
备注
还可以有rows 2 preceding的写法,就是集计到第五行。