我正在尝试复制相当于:
select name, salary, decode(salary > 100, "Nice Job", job) as job
from blah...
blah table being:
name
salary
job
是否有相当于解码或if或switch或什么?
答案 0 :(得分:1)
尝试:
select name, salary, case when salary > 100 then "Nice Job" else job end as job
from blah...
答案 1 :(得分:1)
如果job
是整数,则需要将其转换为字符串:
select (case when salary > 100 then "Nice Job" else cast(job as varchar(255))
end) as job