Reputation: 1260
I'm trying to delete duplicate rows from wordpress tables and I'm getting sql error
#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
like this and My query is
DELETE FROM wp_posts a, wp_posts b WHERE a.ID > b.ID AND a.post_title = b.post_title
Can anyone please help me to fix this.
thank you in advance.
Upvotes: 0
Views: 102
Reputation: 1260
feeling guilty to answer my question. Anyway I found an error,
My query should be,
DELETE a FROM wp_posts a, wp_posts b WHERE a.ID > b.ID AND a.post_title = b.post_title;
like this.
Upvotes: 0
Reputation: 1790
Delete does Alias in a different way.
DELETE FROM a USING wp_posts a, wp_posts b
WHERE a.ID > b.ID AND a.post_title = b.post_title
see here for more information
Upvotes: 1