SELECT A.strCorrItemID AS 项目编码 ,
B.主项目号 ,
SUM(dblSum) AS 合同金额
FROM CM_Contract_Item_B A
LEFT JOIN fitemss00 B ON A.strCorrItemID = B.citemcode
GROUP BY A.strCorrItemID ,
B.主项目号;
SELECT cItemCode AS 项目编码 ,
SUM(iSum) AS 销售订单金额
FROM SO_SODetails
GROUP BY cItemCode;
SELECT cItemCode AS 项目编码 ,
SUM(iSum) AS 开票金额
FROM SaleBillVouchs
GROUP BY cItemCode;
SELECT A.cXm AS 项目编码 ,
SUM(iAmt) AS 收款金额
FROM Ap_CloseBills A
JOIN dbo.Ap_CloseBill B ON A.iID = B.iID
WHERE B.cVouchType = 48
GROUP BY A.cXm;