Forum Moderators: coopster

Message Too Old, No Replies

Update Mysql Data?

         

smartcard

4:04 pm on May 13, 2006 (gmt 0)

10+ Year Member



I have a mysql table with many records, one of the field called 'filed1' contains data.

I need to find and replace all the letters like "box" to "boxes" in filed1

What is the command please?

eelixduppy

4:12 pm on May 13, 2006 (gmt 0)



UPDATE table_name SET field1 = "boxes" where field1 = "box";

eelix

dreamcatcher

6:39 pm on May 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The UPDATE syntax would overwrite all data if used above. If thats what you wanted eelixduppy's solution will be fine.

If you wanted to run a search and replace on data in a table, but not delete the original data use REPLACE:

UPDATE table SET field = REPLACE(field, 'box', 'boxes');

dc