如何替换SQL中的部分字符串

2021-09-28 00:00:00 string sql url mysql wordpress

我在数据库列guid"中有 URL

i have URL in db column "guid"

http://example.com/wp-content/uploads/2014/03/Waterproofing2.png

我需要把它改成

http://example.com/blog/wp-content/uploads/2014/03/Waterproofing2.png

我需要用

http://example.com/wp-content/uploads/

http://example.com/blog/wp-content/uploads/

推荐答案

使用 替换 函数:

update `table` set `column`= replace (`column`, 'http://example.com/','http://example.com/blog/') where `column`like 'http://example.com/blog/wp-content/uploads%'

相关文章