mysql - Multiple replace statement SQL? -


i want take field, search occurrence of 1 out of 2 possible names: cross or memory. depending on 1 is, replace corresponding img.

my current code (that works) follows:

select replace(column_name,'cross','<img src=\"crossimg.png\" />') 'column_name' my_table; 

i want this:

select replace(column_name, if == 'cross' img1, elseif == 'memory' img2) 'column_name' my_table; 

you looking case statement:

select case when column_name = 'cross' img1  when column_name='memory' img2 else column_name end column_name my_table; 

Comments