Ad

How Can I Delete Multiple Keywords From A Column

- 1 answer

I'm running

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

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

But how would I delete apple, and also other words at the same time?

I tried

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

and it wouldnt work

Ad

Answer

you need to do nested REPLACE calls:

UPDATE mytable SET FruitsColumn =
REPLACE(REPLACE(FruitsColumn,'orange',''),'apple','')
Ad
source: stackoverflow.com
Ad