mysql dynamic replace (like a case on the search) -


i have situation replace value search 1 of 2 scenarios - want find either 1 , replace 1 value regardless of scenario found.

what need syntax simulate: replace(columna, 'value1' or 'value2', 'value3')

any ideas?

so without knowing of details wont complete answer until clarify more.. general approach can use

select     case          when locate('value1',columna) > 0  -- # -- find condition , replace or else replace condition         replace (columna, 'value1', 'value3')         else replace(columna, 'value2', 'value3')     end ... 

so may want different condition understood if value1 inside columna want replace value 3 or else put in value 2..


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -