Wednesday, 1 April 2015

Count duplicate record’s using mysql ?



SELECT name, COUNT(*) AS times, IF (COUNT(*)>1,"duplicated", "not duplicated") AS duplicated FROM <MY_TABLE> GROUP BY name

ANS: AAA 2 duplicated
     BBB 3 duplicated
     CCC 1 not duplicated

No comments:

Post a Comment