1 SELECT 2 A.型号, 3 NVL(B.领用个数SUM,0) AS 共领料, 4 NVL(C.入库数量SUM,0) AS 共入库, 5 FROM 型号表 A 6 LEFT JOIN ( 7 SELECT SUBB.型号,SUM(SUBB.领用个数) AS 领用个数SUM 8 FROM 领料表 SUBB 9 GROUP BY 型号 10 ) B 11 ON B.型号 = A.型号 12 LEFT JOIN ( 13 SELECT SUBC.型号,SUM(SUBC.入库数量) AS 入库数量SUM 14 FROM 入库表 SUBC 15 GROUP BY 型号 16 ) C 17 ON C.型号 = A.型号 18 ORDER BY A.型号 ASC