Mysql Replace Function Usage

23-12-2014

If you want to change some string content of a column, you can use REPLACE function as follow:

UPDATE urls
SET url = REPLACE(url, 'domain1.com/images/', 'domain2.com/otherfolder/')

urls: Table Name
url: Column Name

REPLACE function first parameter is column name, second parameter string value to be changed, and third parameter is new string value.

© 2019 All rights reserved. Codesenior.COM