SELECT 单号, (CASE WHEN 单号 LIKE 'QW%' THEN 1 WHEN 单号 LIKE 'TH%' THEN -1 ELSE 0 END) * 金额
FROM A
select 单号,case when 单号 like 'QW%' then 金额 when 单号 like 'TH%' then -1*金额 else 金额 end 金额
from A;
select 单号,
(case substr(单号,1,2) when 'QW' then 金额
when 'TH' then -1*金额
end case) as 金额
from A
select case when substr(单号,1,2) ='QW' then abs(单号)
when substr(单号,1,2) =TH' then -abs(单号)
end case,
金额 from A