删除wordpress中的重复行时出现#1064错误

时间:2013-10-30 05:39:55

标签: mysql sql wordpress

我正在尝试从wordpress表中删除重复的行,我收到了sql错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a, wp_posts b WHERE a.ID > b.ID AND a.post_title = b.post_title' at line 1
像这样 我的查询是

DELETE FROM wp_posts a, wp_posts b WHERE a.ID > b.ID AND a.post_title = b.post_title

任何人都可以帮我解决这个问题。

提前谢谢。

2 个答案:

答案 0 :(得分:1)

删除以不同的方式执行别名。

DELETE FROM a USING wp_posts a, wp_posts b 
WHERE a.ID > b.ID AND a.post_title = b.post_title

有关详细信息,请参阅here

答案 1 :(得分:0)

感到内疚回答我的问题。无论如何我发现了一个错误,

我的查询应该是,

DELETE a FROM  wp_posts a, wp_posts b WHERE a.ID > b.ID AND a.post_title = b.post_title;
像这样。