harishkumar329
harishkumar329

Reputation: 1260

#1064 error while deleting duplicate rows in wordpress

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

Answers (2)

harishkumar329
harishkumar329

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

Shaun Peterson
Shaun Peterson

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

Related Questions