楼上的答案是错的,集函数是不能这么用的以下是正确答案,可以包含多级所属关系insert into reporttotal (repid, repname, repdate, orgid, cellid total_value) select repid, repname, repdate, (select orgid from org where orgname = '国有商业银行'), '1a', sum(value) from reportdata where repname = '资产负债表' and repdate = '2009-03-31' and ordid in /*找到所有子机构orgid*/ (select childorgid from orgrlt connect by parentorgid = prior childorgid start with parentorgid = (select orgid from org where orgname = '国有商业银行')) group by repid, repname, repdate) /*使用报告id,名称,日期分组*/ 20210311