Reputation: 1683
I am trying to select a column and do a multiple replacement i.e
Col1
a
b
c
d
select col1 and replace a = 1, b=2 and c=3
Col1
1
2
3
d
I am aware of update and replace but only for a single rule at a time
Upvotes: 0
Views: 35
Reputation: 39507
You can use CASE:
select
case when col1 = 'a' then '1'
when col1 = 'b' then '2'
when col1 = 'c' then '3'
else col1
end
from table;
Upvotes: 1