How to search replace string text in a table field in mysql

I have a date field in my mysql database table. I want to replace year 2017 in this field to 2019 Following command would do this.

UPDATE races SET `date` =REPLACE( `date` , ‘2018’, ‘2019’ ) WHERE INSTR( `date` , ‘2018’ ) >0

Just saving it for reference here.

Leave a Reply

Your email address will not be published.