我正在进行wordpress迁移,我想将本地url网站更改为新的生产url。
我想根据此查询以不同的值更新每一行:
SELECT IF(guid LIKE '%test.local%', REPLACE(guid, 'http://test.local', 'prod-url'),
REPLACE(guid, SUBSTRING_INDEX(guid, "/", 3), "prod-url")) AS "guid"
FROM wp_posts
这是我已执行的mysql查询:
UPDATE wp_posts SET a.guid =(SELECT * FROM (
SELECT IF(guid LIKE '%test.local%',
REPLACE(guid, 'http://test.local', 'prod-url'),
REPLACE(guid, SUBSTRING_INDEX(guid, "/", 3), "prod-url")) AS "guid"
FROM wp_posts) AS X )
实际输出是错误:子查询返回多于1行