$sql = "select count(email) as ct, email as count from table_1 group by
userid, email";
$result = mysql_query($sq l) or die(mysql_error ());
while($row = mysql_fetch_arr ay($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*******@hotm ail.com> wrote in message
news:2W******** **************@ news.easynews.c om...
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