I want to add the prefix to column’s data those who not like if the column’s value is 123,OI:909, 456,OI:789
then it updates to OI:123,OI:909, OI:456, OI:789
I tried following SQL
select col_1(case when col_1 NOT LIKE '%OI:%' then concat("OI:",col_1) end) from table_1;
Advertisement
Answer
You could try this syntax:
select case when col_1 NOT LIKE '%OI:%' then concat("OI:",col_1) ELSE col_1 end col1 from table_1;