kalp3
kalp3

Reputation: 43

How can I delete multiple keywords from a column

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

Upvotes: 4

Views: 60

Answers (1)

Nir Levy
Nir Levy

Reputation: 12953

you need to do nested REPLACE calls:

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

Upvotes: 4

Related Questions