Skip to content

Instantly share code, notes, and snippets.

@MikeRogers0
Created June 16, 2012 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeRogers0/2942013 to your computer and use it in GitHub Desktop.
Save MikeRogers0/2942013 to your computer and use it in GitHub Desktop.
MySQL REPLACE function
REPLACE('Original String', 'Find This', 'Replace with this')
# So it can be used like:
SELECT REPLACE('My Original String', 'Original', 'Modified');
# This will output: My Modified String
# So if you wanted to go through a full table and replace a bunch of strings, you could use it like this:
UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, 'Find Me', 'Replace with Me');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment