Home » , » Find duplicate records in php mysql

Find duplicate records in php mysql

Written By Unknown on Sabtu, 16 Juli 2011 | 03.38

To find duplicate records in php mysql database use this query. It will list all duplicate entries which occurs more than once.

  $table='emails';

$sql="SELECT email FROM $table WHERE email in (
SELECT email FROM $table GROUP BY email
HAVING count(email) > 1)";
$result=mysql_query($sql);
$n=1;
while($row = mysql_fetch_array($result)){
echo '<br />('.$n.')';
echo $row['email'];
$n++;
}

Share this article :

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger