January 12 2013

Mysql replace() function

Tagged Under : ,

MySQL
Because I found that record save inside the database have typo problem.

How to solve it? Normally I will use PHP str_replace to solve the issue. But now requires use SQL to print out all the record and replace the typo.

There is one of the functions from MySQL which help to solve this problem.

Syntax:
REPLACE(str, find_string, replace_with)
Example:
SELECT REPLACE('chervonscode','rv','vr');  
Output:
chevronscode

Make a Comment

*

code