MySql - Way to update portion of a string? MySql - Way to update portion of a string? mysql mysql

MySql - Way to update portion of a string?


I think this should work:

UPDATE tableSET field = REPLACE(field, 'string', 'anothervalue')WHERE field LIKE '%string%';


UPDATE `table` SET `field` = REPLACE(`field`, 'string', 'anothervalue')


Use the LIKE operator to find the rows that you care about and update them using the REPLACE function.

For example:

UPDATE table_name SET field_name = REPLACE(field_name,'search','replace') WHERE field_name LIKE '%some_value%'