想知道下面的查詢有什麼問題嗎?我的SQL Case Query有什麼問題
case
b.transaction_id,
when b.total_discount<0 then (ABS(b.total_discount)/(b.total_revenue + ABS(b.total_discount)) else '0' end as pct_discount_off
from transaction b
出現錯誤消息。
Msg 156, Level 15, State 1, Line 27
Incorrect syntax near the keyword 'end'
缺少 ')'。 ABS(b.total_discount))) –