|
|
Using SELECT REPLACE with MySQL - Mysql
|
Views : 463
|
|
Tagged in : Mysql
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
You can find and replace text in mysql using REPLACE function.
The REPLACE() function takes three parameters:
1. the string or column name to do the replacement on
2. what to look for
3. and what to replace it with
The following example replaces the 'aaa' part of 'aaa bbb ccc' with 'xyz' and the column returned from the SQL query will contain 'xyz bbb ccc':
SELECT REPLACE('aaa bbb ccc', 'aaa', 'xyz');
If you were doing this against the column "foo" you would do this instead:
SELECT REPLACE(foo, 'aaa', 'xyz'); |
|
By Rekha, On - 2010-01-28 |
|
|
|