Thread Starter
pinokio
(@lapanwebsite)
Taking a look at some of the images of WordPress’ schema then you should be able to identify the records you want to delete with a query such as
SELECT wp_comments.*
FROM wp_comments
LEFT JOIN (
SELECT MIN(comment_id) comment_id
FROM wp_comments
GROUP BY comment_post_id, comment_author, comment_content
) to_keep ON wp_comments.comment_id = to_keep.comment_id
WHERE to_keep.comment_id IS NULL
You should run the query above and make sure you it is returning the correct records (the ones that will be deleted). Once you are satisfied the query is working then simply change it from a SELECT to a DELETE
DELETE wp_comments
FROM wp_comments
LEFT JOIN (
SELECT MIN(comment_id) comment_id
FROM wp_comments
GROUP BY comment_post_id, comment_author, comment_content
) to_keep ON wp_comments.comment_id = to_keep.comment_id
WHERE to_keep.comment_id IS NULL
By TI from stackoverflow.