當我們使用v9.1時,我工作得很好,但是在升級到v9.4後,以下失敗。PostgreSQL CASE WHEN Then ELSE END錯誤
SELECT a.account_id
(
select round(cast(sum(WHEN c.transaction_type = 'Ranger' THEN c.original_currency ELSE c.original_currency * -1
end)) AS NUMERIC),
2)
FROM account_transaction AS c
WHERE a.account_id = c.account_id
GROUP BY c.account_id)
AS
balance_amount
FROM account
AS
a LEFT JOIN account_type
AS
b ON a.account_type_id = b.account_type_id
WHERE (
b.description >= 'Boomberang' AND b.description <= 'Boomberang'
);
語法錯誤或接近WHEN
我用Google搜索,但未能解決問題。請幫忙。
你說得對。這個詞缺失。它應該是CASE WHEN。我很抱歉我的困惑。謝謝你指出。 –