請教一下各位大佬,想要實作 在一級、二級、三級、四級專案下的金額逐級匯總 ,四-->三,三-->二,二-->一。
select cno,
cname,
f_cno,
clevel,
type,
sign,
cmoney,
(select sum(t.cmoney)
from cpppp t where connect_by_isleaf = '1'
start with t.cno = a.cno and t.type='2'
connect by prior t.cno = t.f_cno )
from cpppp a where type='2'
但是出現的問題是,存在多個一級專案,匯總之后,匯總資料錯誤。
希望大佬給指點一下 ,謝謝!!!
uj5u.com熱心網友回復:
給出創建陳述句和一些測驗資料。uj5u.com熱心網友回復:
應該可以參考rollup和grouping函式用法uj5u.com熱心網友回復:
分析函式,SUM( CMONEY )OVER( ORDER BY CLEVEL ) 就可以了轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/60632.html
標籤:開發
