我有一个附加查询来计算总价格并附加到表中。总和列工作正常,但计算列不正常。它给出错误,指出它不是聚合函数的一部分。我不明白这个错误。以下是我的 SQL:
INSERT INTO tbl_Worksheet ( WEstProj, WItemInd, WItemName, WALHP, WAMP, WASubT, WEstimator, WItemType, WAIP )
SELECT DISTINCTROW tbl_ProjIndex.PItemProj, tbl_ProjIndex.PItem, tbl_ProjIndex.PItemName, Sum(tbl_SOW.STEHR) AS SumOfSTEHR, Sum(tbl_SOW.SCalMtlCst) AS SumOfSCalMtlCst, Sum(tbl_SOW.SCalSubCst) AS SumOfSCalSubCst, tbl_SOW.SEstIni, tbl_SOW.SItemType, [esPricingTotal] AS Expr1
FROM tblPSheet INNER JOIN ((tbl_ProjIndex INNER JOIN tbl_SOW ON tbl_ProjIndex.[ProjIdxID] = tbl_SOW.[ProjIdxID]) INNER JOIN tbl_Worksheet ON tbl_ProjIndex.ProjIdxID = tbl_Worksheet.ProjIdxID) ON tblPSheet.PricingID = tbl_Worksheet.ProjIdxID
GROUP BY tbl_ProjIndex.PItemProj, tbl_ProjIndex.PItem, tbl_ProjIndex.PItemName, tbl_SOW.SEstIni, tbl_SOW.SItemType
HAVING ((([esPricingTotal])=Round((((1+[tblPSheet]![PRABMU])*([tbl_SOW]![STEHR]*[tblPSheet]![PRHMPY])+([tbl_SOW]![SCalMtlCst]*[tblPSheet]![PRHMPY]=(1+"tblPSheet]![PRABMU]"+"tblPSheet]![PRAVGMU] "))+([tbl_SOW]![SCalSubCst])*(1+[tblPSheet]![PRABMU]+[tblPSheet]![PRAVGMU]))))));
我做错了什么?