参考:http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

使用示例:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

TABLE_NAME:表名

FIELD_NAME:字段

比如url=http://www.baidu.com/?search=abc

UPDATE photo SET

url=REPLACE(url, ‘baidu.com’, ‘google’)

执行完:url=http://www.google.com/?search=abc



Published

22 April 2013