SELECT ERI, PROD, PRICE, REALQTY, INVAMT, (SELECT CNAME FROM PRODUCT WHERE CODE=T.PROD) as ProdCName, ((1)*INVAMT-(SELECT ISNULL(SUM(RCVAMT),0) FROM BILRCVDETAIL WHERE OUTPUTRECERI=T.ERI AND SRCERI<>‘090ADA0KKMCZHOU0‘)) as UnRcv FROM STKSALE2 T WHERE MASTERI=‘0H5A8O063TNJ319K‘ AND (SELECT (1)*ISNULL(SUM(RCVAMT),0) FROM BILRCVDETAIL WHERE OUTPUTRECERI=T.ERI AND SRCERI<>‘090ADA0KKMCZHOU0‘)<>T.INVAMT
结果:
程序界面: