Wednesday, 30 March 2016

Find duplicate data in MySQL

<?php
        $con = mysql_connect('localhost', 'root', '');
        $db  = mysql_select_db('test', $con);

        $data = mysql_query('SELECT COUNT(price) as result, price as price FROM products GROUP BY price');

       while($r = mysql_fetch_array($data))
      {
 echo  $r['price'].'--'.$r['result'] .'<br>';
       }
?>

1 comment: