我正在尝试更新SQL数据库中的图像路径。我尝试了以下但是没有用:
UPDATE `wp_posts`
SET `post_content` = replace(`post_content`,'%src="http://www.theworldeffect.com/.a/%"%','src="http://www.domainname.com/timages/%.jpg"')
答案 0 :(得分:0)
试试这个
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
这
http://www.mydigitallife.info/how-to-find-and-replace-text-in-mysql-database-using-sql/
答案 1 :(得分:0)
replace()不会为你做正则表达式匹配。您只能使用它将另一个静态字符串替换为给定字符串,例如
replace(`post_content`, 'src="http://www.theworldeffect.com/.a/',
'src="http://www.domainname.com/timages/')
这只会替换前缀,但这对您来说已经足够了。