$sql = "select count(email) as ct, email as count from table_1 group by
userid, email";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
if($row['email'] > 1) {
$newsql = "delete from table_1 where email = $row['email'] limit
$row['ct']-1";
run $newsql;
}
}
This should remove all duplicates.
"Wm" <LA*******@hotmail.com> wrote in message
news:2W**********************@news.easynews.com...
I have a table of users in mySQL that appears to have a lot of duplicates.
What's the best way to look at the userID and email and delete the
duplicates?
Thanx,
Wm