mysql-批量修改表字段中的某一部分内容

MySQL批量替换指定字段字符串语句
(1)updat 表名 set 字段名=replace(字段名,'原来的内容','替换后的内容')
  举一个例子,就是我实际操作的时候的命令:

1  update cpg1410_pictures set filepath=replace(filepath,'wallpapers/art/','wallpapers/beautiful/art/')
2   或者
3  update xb_upload_1 set fileurl=replace(fileurl,'www.baidu.com/','baidu.com/')

(2)updat 数据表名 SET 字段名 = replace(字段名, '要替换的字符串', '替换为') where 设定条件;
  语句中还可以加入替换条件,如只替换限定ID小于200的内容:

1 update wp_posts SET post_content = replace(post_content, '搜索引擎优化', '搜索引擎营销') where ID < 200;
原文地址:https://www.cnblogs.com/zsczsc/p/7541550.html