親と子を検索して重みを計算するこの SQL クエリがあります。
select componentid,
         (select sum(cs.weightkg)
            from component c2, componentstats cs
           where c2.componentstatsid = cs.componentstatsid
               start with c2.componentid = c1.componentid
         connect by prior c2.componentid = c2.fkcomponentid) sum_weightkg
from component c1
start with c1.fkcomponentid = 100
connect by prior componentid = fkcomponentid
問題は、SQL クエリで合計重量を数値 (集計されたすべての数値) として返すようにすることです。
これは私が得る結果です:
COMPONENTID            SUM_WEIGHTKG           
---------------------- ---------------------- 
201                    410                    
231                    210                    
323                    10
SQLクエリを書き直すのを手伝ってくれませんか?