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
Post a Comment