0
我有以下SQL查詢:總和案例SQL語法錯誤
SELECT
CompanyCode, PaymentStatus, PaymentType, PaySource,
SUM(CCur(PaymentAmount)),
SUM(CASE WHEN PaymentStatus='APPROVED' THEN 1 ELSE 0 END) AS Approved,
COUNT(*)
FROM
Detail_Work
GROUP BY
CompanyCode, PaymentType, PaymentStatus, PaySource
ORDER BY
CompanyCode, PaymentType, PaymentStatus, PaySource
而且我得到以下錯誤:
Syntax Error (Missing Operator) in query Expression 'SUM(CASE WHEN PaymentStatus='APPROVED' THEN 1 ELSE 0 END)'
PaymentStatus是批准或拒絕。 – GhostDZ9