加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

mysql与正则表达式

发布时间:2020-12-12 02:23:29 所属栏目:MySql教程 来源:网络整理
导读:将comment表中的author_url包含www.sohu.com的记录,其中的sohu替换为sina,一个语句搞定~ update comment set author_url=REPLACE(author_url,'sohu','sina') where author_url REGEXP "www.sohu.com"; 带IF判断的复杂替换 update comment set url= IF(url R

将comment表中的author_url包含www.sohu.com的记录,其中的sohu替换为sina,一个语句搞定~

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

带IF判断的复杂替换

update comment set url=IF(url REGEXP "test.yahoo.com.cn",REPLACE(url,'www1.sohu.com','www.sina.com'),'www2.yahoo.com','www.sina.com')) where 1=1;

?

原文地址:http://www.wujianrong.com/archives/2007/01/mysql_8.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读