How can we achieve this in a single sql (mysql) query ?
I need to search some patterns in a column and if any pattern matches then replace that pattern with a specific string. like if
pattern ptr1 matches then replace this with str1
pattern ptr2 matches then replace this with str2
I need a function like replace that can replace a regular expression. here is my query i need to improve this for regular expression
UPDATE category SET column1 =
(
CASE
WHEN (column1 REGEXP 'xy') THEN REPLACE(column1, 'xy' , 'ffff')
ELSE column1
END
)
Please help me in this.