Skip to content

Instantly share code, notes, and snippets.

@tomfordweb
Created December 2, 2017 17:44
Show Gist options
  • Save tomfordweb/7bee0ec5637e332ac16f32769848b934 to your computer and use it in GitHub Desktop.
Save tomfordweb/7bee0ec5637e332ac16f32769848b934 to your computer and use it in GitHub Desktop.
Delete duplicate posts for WP, but can be used for most anything. Worked very quickly on a 60k row wp_posts table.
DELETE FROM wp_posts
WHERE id IN (SELECT *
FROM (SELECT id FROM wp_posts
GROUP BY post_title HAVING (COUNT(*) > 1)
) AS A
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment