SQL command to find duplicate entries from Phpmyadmin?

19.02.2012

Follow these steps. There is no need to code a .php page in order to run this SQL command. Login to Phpmyadmin, go to the “SQL” tab, write the following command.

SELECT row FROM table GROUP BY row HAVING ( COUNT(row) > 2 ).

Explanation. The table name is named “table” in the command. The “row” name is the row from the table. Example. SELECT name FROM users GROUP BY name HAVING ( COUNT(name) > 2 ). Notice that in our command, the “name” is used three times and “users”, one time.

To tweak the command even further, replace the “2” value with something else, for example: “5”.

To display the entry that has exactly 5 copies for example, use the same command, replacing the “> 5” with equal (=), “SELECT row FROM table GROUP BY row HAVING ( COUNT(row) = 5 )”.

Duplicate entries SQL








Leave a Reply

*
*