/ Published in: PHP
$duplicates checks and groups duplicated rows with the same field1 and field2 (like comments maybe) and $limit counts how many times a row is duplicated.
Expand |
Embed | Plain Text
<?php $duplicates = mysql_query("SELECT field1, field2, count(*) FROM table GROUP BY field1, field2 having count(*) > 1"); if ($count > 0) { $field = $row["field1"]; $limit = $row["count(*)"] - 1; } } ?>
Comments
Subscribe to comments
You need to login to post a comment.

I have a table with item and date created fields. How do I detect duplicate values in the item field compare their date created values get the difference and delete the duplicate item if the difference between the date of the two duplicate values is less than 10 minutes?
I have a table with item and date created fields. How do I detect duplicate values in the item field compare their date created values get the difference and delete the duplicate item if the difference between the date of the two duplicate values is less than 10 minutes?