发布日期:2018-03-26
MySQL字符串替换+ 查看更多
MySQL字符串替换
+ 查看更多
发布日期:2018-02-24 16:30
分类:SQL
浏览次数:222
我有一列包含数据 urls (id, url)
http://www.example.com/articles/updates/43 http://www.example.com/articles/updates/866 http://www.example.com/articles/updates/323 http://www.example.com/articles/updates/seo-url http://www.example.com/articles/updates/4?something=test
我想把以上URL中的“updates”改为“news”,有没有可能实现它的脚本?
回答:
UPDATE your_table SET your_field = REPLACE(your_field, 'articles/updates/', 'articles/news/') WHERE your_field LIKE '%articles/updates/%'