Reputation: 4892
Currently i have this statement and is bringing me correct results
select
case column1
when 'G07' then 'G15'
when 'G09' then 'G15'
when 'G15' then 'G15'
end
as Code
from tableX
The problem with the above is that i have bunch of cases to write for each column, so I'm after something more compact like the following but unfortunately do not compile :
select
case column1
when 'G07','G09','G15' then 'G15'
end
as agente
from tableX
Any thought? Thanx
Upvotes: 0
Views: 33
Reputation: 3572
You can do this by using an alternate form of case
:
select
case
when column1 IN('G07','G09','G15') then 'G15'
end
as agente
from tableX
Upvotes: 3