MySQL 文字列の置換 質問する

MySQL 文字列の置換 質問する

URL (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

「更新」という単語を「ニュース」に変更したいのですが、スクリプトでこれを行うことは可能ですか?

ベストアンサー1

UPDATE your_table
SET your_field = REPLACE(your_field, 'articles/updates/', 'articles/news/')
WHERE your_field LIKE '%articles/updates/%'

今では、

http://www.example.com/articles/updates/43

だろう

http://www.example.com/articles/news/43

http://www.electrictoolbox.com/mysql-find-replace-text/

おすすめ記事