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

MySQL批量替换指定字段字符串语句 一、update 表名 set 字段名=replace(字段名,'原来的内容','替换后的内容') 举一个例子,就是我实际操作的时候的命令: update cpg1410_pictures set filepath=replace(filepath,'wallpapers/art/','wallpapers/beautiful/art/') 或者 update xb_upload_1 set fileurl=replace(fileurl,'www.baidu.com/','baidu.com/') 二、update 数据表名 SET 字段名 = replace(字段名, '要替换的字符串', '替换为') wher 设定条件; 语句中还可以加入替换条件,如只替换限定ID小于200的内容: update wp_posts SET post_content = replace(post_content, '搜索引擎优化', '搜索引擎营销') wher ID < 200;
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2022

备案号:京ICP备15003423号-3