Oracle行結果合計的實現,主要應用於日期結果的集計,下麵是具體的實現代碼。 With AA as ( select 'A' tNo , 10 B from dual union select 'B' , 20 from dual union select 'A' , 30 from dual ) ...
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的寫法,就是集計到第五行。