Click to See Complete Forum and Search --> : simple query question


Leafgreen
10-21-2008, 11:38 PM
Regarding this query
UPDATE table_name SET field_x = REPLACE(field_x, 'this text', 'that text')

I just want to be sure on the following: If field_x contains the following value:
ajaoiefjfod this text lajfklj alkjfdalkaj alkdjf

will running this query result in
ajaoiefjfod that text lajfklj alkjfdalkaj alkdjf

or

that text
?

scragar
10-21-2008, 11:44 PM
I do think you should just have tried it, but it will result in your first answer:

ajaoiefjfod that text lajfklj alkjfdalkaj alkdjf

It replaces the second argument in the first argument with the third argument.
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

Leafgreen
10-22-2008, 02:42 AM
many thanks!