You could do a select all query and then loop through those. While in the loop do a query that delete anything that is the same and doesn't have the ID of current index. Backup first.
Update:
I prefer to keep this kind of code in a separate file in the root directory.
SO make a new file in root and call it whatever you want and then add this code. Run the file AFTER YOU BACKUP your comment and comment meta tables.
You could do a select all query and then loop through those. While in the loop do a query that delete anything that is the same and doesn't have the ID of current index. Backup first.
Update:
I prefer to keep this kind of code in a separate file in the root directory.
SO make a new file in root and call it whatever you want and then add this code. Run the file AFTER YOU BACKUP your comment and comment meta tables.
<?php
require('./wp-load.php');
global $wpdb; // loads the DB object
$comments = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."comments");
foreach((array)$comments as $key => $comment)
{
$id_to_check = $comment->comment_ID; // keep this comment ID
$get_dupes = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."comments WHERE comment_content = '".$comment->comment_content."' AND comment_ID != $id_to_check OR comment_date = '".$comment->comment_date."' AND comment_ID != '".$id_to_check."' ");
foreach((array)$get_dupes as $dkey => $dupe)
{
$wpdb->query("DELETE FROM ".$wpdb->prefix."commentmeta WHERE comment_id = '".$dupe->comment_ID."'"); // delete duplicate comment meta
}
$wpdb->query("DELETE FROM ".$wpdb->prefix."comments WHERE comment_ID = '".$dupe->comment_ID."'"); // delete duplicate comment
}
echo 'all done!'
?>