一.
case [字段] when '要比較的值' then 表達式 when '要比較的值' then 表達式 else '' end
示例
select
(case ApplyAmount
when null then 0 --判斷為空時,取0
else ApplyAmount end) as ApplyAmount
from HTFKApply
二.
case when [條件] then 表達式 when [條件] then 表達式 else '' end
示例
select
case when (a.ApplyAmount is null) then 0
else a.ApplyAmount end as ApplyAmount from HTFKApply