mysql UPDATE批量替换指定字段字符串语句

mysql UPDATE批量替换指定字段字符串语句

UPDATE 数据表名 SET 字段名 = replace(字段名, ‘要替换的字符串’, ‘替换为’) WHERE 设定条件;

UPDATE `table_name` SET `字段名` = replace (`字段名`,'要替换的字符串','替换为的字符串')

UPDATE `decoratingcases` SET `address` = replace (`address`,'北京市北京市','北京市') where address like '%北京市北京市%';

将address字段里重复的“北京市北京市”替换成“北京市”。


分享到 :
相关推荐

Leave a Reply

Your email address will not be published. Required fields are marked *