You are here

9 November 2013

Snippet showing, how to do string replace in MySQL. In this example we update a field with the same field content except we run it through string replace. This is the same as find & replace in text editor. In this query you replace into the same field that you selected, but you can use different fields in this process as well.

Source code viewer
  1. UPDATE table_name SET field_name = replace(field_name, 'needle', 'replacement') WHERE id = 1;
Programming Language: MySQL