嗨,我正在尝试执行下面的 qry,并且在 subqry sum 行上不断收到“不能在表达式中具有聚合函数”错误。有什么办法可以使这项工作?
SELECT ID,
DateColumn,
Contamination,
BrokenGlass,
OtherReasons,
SUM(Contamination) + SUM(BrokenGlass) + SUM(OtherReasons) AS Total,
SUM(Contamination) / Total AS Expr1,
(SELECT SUM(Contamination)/ SUM(SUM(Contamination) + SUM(BrokenGlass) + SUM(OtherReasons))
FROM tbltest T2
WHERE T2.ID <= T2.ID) AS RunningSum
FROM tbltest
GROUP BY ID, DateColumn, Contamination, BrokenGlass, OtherReasons