SELECT C.AFNUMBER,C.BFNUMBER,F.EFNUMBER FROM(SELECT A.FID,A.FNUMBER AFNUMBER,B.FNUMBER BFNUMBER FROM T_ENG_BOM A INNER JOIN T_BD_MATERIAL B ON(A.FMATERIALID=B.FMATERIALID AND A.FFORBIDSTATUS='A' AND A.FUSEORGID=使用组织ID)) C INNER JOIN (SELECT D.FID,E.FNUMBER EFNUMBER FROM T_ENG_BOMCHILD D INNER JOIN T_BD_MATERIAL E ON(D.FMATERIALID=E.FMATERIALID))F ON(C.FID=F.FID)
EXCEPT
SELECT C.AFNUMBER,C.BFNUMBER,F.EFNUMBER FROM(SELECT A.FID,A.FNUMBER AFNUMBER,B.FNUMBER BFNUMBER FROM T_ENG_BOM A INNER JOIN T_BD_MATERIAL B ON(A.FMATERIALID=B.FMATERIALID AND A.FUSEORGID=创建组织ID)) C
INNER JOIN (SELECT D.FID,E.FNUMBER EFNUMBER FROM T_ENG_BOMCHILD D INNER JOIN T_BD_MATERIAL E ON(D.FMATERIALID=E.FMATERIALID))F ON(C.FID=F.FID)ORDER BY AFNUMBER
推荐阅读