我在下面的sql CASE语句中收到错误。它在(CASE WHEN SUM(ISNULL(OQ.Quantity,0) = 0 THEN SUM(R.Quantity) - SUM(R.Quantity * .9275))
上爆炸。有人可以帮忙吗?感谢
CASE
WHEN SUM(ISNULL(OQ.Quantity,0)) = 0 THEN SUM(R.Quantity * .9275)
ELSE SUM(OQ.Quantity)
END AS On_Time_Quantity,
CASE
WHEN SUM(ISNULL(OQ.Quantity,0)) > SUM(R.Quantity) THEN 0
ELSE
**CASE WHEN SUM(ISNULL(OQ.Quantity,0) = 0 THEN SUM(R.Quantity) - SUM(R.Quantity * .9275))**
ELSE
CASE WHEN SUM(ISNULL(OQ.Quantity,0) < SUM(R.Quantity) THEN SUM(R.Quantity) - SUM(ISNULL(OQ.Quantity,0))
END
END AS Late_Quantity,
答案 0 :(得分:0)
在新行上有THEN
或在THEN
之前使用冒号终止表达式:
CASE
WHEN ... ; THEN
OR
CASE
WHEN ...
THEN