將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判斷的復(fù)雜替換
update comment set url=IF(url REGEXP "test.yahoo.com.cn",REPLACE(url, 'www1.sohu.com', 'www.sina.com'),REPLACE(url, 'www2.yahoo.com', 'www.sina.com')) where 1=1;
原文地址:http://www.wujianrong.com/archives/2007/01/mysql_8.html
新聞熱點
疑難解答
圖片精選