如何计算整列的百分比?目前我到目前为止所写的内容只给了我每行的百分比。我只想要 1 行的总百分比。我想将所有值相加以计算一个百分比。
SELECT TOP 1000
CONVERT(DECIMAL(10, 2), CAST(Passed AS DECIMAL(10, 2))
/ ( Actual ) * 100) AS Percent
FROM Audits
WHERE
MONTH(TransActionDate) = MONTH(GETDATE())
GROUP BY Actual
, Passed
, transactiondate
ORDER BY TransActionDate DESC