Skip to content

Instantly share code, notes, and snippets.

@sproutventure
Created September 8, 2010 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sproutventure/569497 to your computer and use it in GitHub Desktop.
Save sproutventure/569497 to your computer and use it in GitHub Desktop.
# Delete duplicate comments
// Creates a temp table of IDs to compare later
CREATE TEMPORARY TABLE unique_comments SELECT MAX(c1.comment_ID) as ID FROM wp_comments c1 GROUP BY c1.comment_content ORDER BY ID;
// If the comment ID isn't in the unique table delete it
DELETE FROM wp_comments WHERE comment_ID NOT IN (SELECT ID FROM unique_comments);
@sproutventure
Copy link
Author

Yeah ... those comments are not SQL friendly at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment