Mysql替换字段中指定的部分字符串

问题描述:
mysql varchar型字段中,替换字段中指定的部分字符串

解决方法:

使用replace(obj, search, replace_str)函数;

sql语法:

UPDATE 表名 SET 字段名=replace(字段名, '被替换字符串', '用来替换的字符串') ;

使用样例:

UPDATE `member` SET `phone`=replace(`phone`, '\', '') ;
update item as t set t.share_descs=REPLACE(t.share_descs,'罗莱LOVO','LOVO') WHERE t.theme = '2c9280856efd0b23016efdacb45c0444'