How to remove multiple keywords from a column

I run

UPDATE mytable SET FruitsColumn = REPLACE(FruitsColumn,'apple','')

it works fine and removes every instance of the word "apple" from my column.

But how can I remove an apple, as well as other words at the same time?

I tried

UPDATE mytable SET FruitsColumn = REPLACE(FruitsColumn,'apple,orange,strawberry','')

and it does not work

+4
source share
1 answer

you need to make nested REPLACE calls:

UPDATE mytable SET FruitsColumn =
REPLACE(REPLACE(FruitsColumn,'orange',''),'apple','')
+4
source

Source: https://habr.com/ru/post/1621913/


All Articles