Posted: Fri Aug 26, 2005 10:32 am
Using a combination of replies here is what I did....
first used the sql..
and put the ID field of all the dupes into an array. then used the code..
No matter how many duplicates there are this works.. you just have to keep refreshing the page and each time it will remove one of the dupes.
Thanks for your help all!
Will
first used the sql..
Code: Select all
SELECT COUNT(t1.ID) AS siblings FROM table t1 NATURAL LEFT JOIN table t2 GROUP BY t1.ID HAVING siblings > 1Code: Select all
$x = 0;
foreach($dupes as $id) {
$sql = "DELETE FROM table WHERE ID = $id LIMIT 1";
if(mysql_query($sql)) {
$x++;
}
}
echo "$x duplicates deleted";Thanks for your help all!
Will