主页 M

mysql正则替换总结

2020-12-07 网页编程网 网页编程网

1.正则替换某个字段值里面的某个字符串

UPDATE `ccvms_video` SET title=REPLACE(title, "最", "相对") WHERE title LIKE '%最%';

2.删除字符

“./uploads/110100_cityHotel_北京富豪华宾馆.jpg”都修改为“./uploads/110100cityHotel北京富豪华宾馆.jpg

update master_data.md_employee set name=replace(name,"_",'') where id = 825;

replace(object,search,replace)把object中出现search的全部替换为replace。

再如:

Update soft SET link=REPLACE(link, '.zip', '.rar') where aid > 53;

update comment set author_url=REPLACE(author_url,'sohu','sina') where author_url REGEXP 'www.sohu.com';

阅读原文
阅读 3405
123 显示电脑版