将comment表中的author_url包含www.sohu.com的记录,其中的sohu替换为sina,一个语句搞定~
updatecommentsetauthor_url=REPLACE(author_url,'sohu','sina')whereauthor_urlREGEXP'www.sohu.com';
带IF判断的复杂替换
updatecommentseturl=IF(urlREGEXP'test.yahoo.com.cn',REPLACE(url,'www1.sohu.com','www.sina.com'),REPLACE(url,'www2.yahoo.com','www.sina.com'))where1=1;