tags:

views:

17

answers:

2

I want to delete part of a record. For example, a column called "message" contains the following string:

"Hi, My name is John"

I want to delete just "John" from the above while retaining the "Hi, My name is" part in tact.

How can this be done?

+2  A: 

You don't delete anything; the row is updated.

UPDATE table_name SET
message = "Hi, My name is"
WHERE message = "Hi, My name is John"
Coronatus
A: 

This would work:

UPDATE SomeTable SET message = REPLACE(message, "John", "") WHERE id = 123;

maclema
Thanks, works great.
John