How to count of duplicate values in MySQL table

To check duplicate records in MySql table, use this simple query

$ Select DISTINCT(name) as username, count(name) as usercount from usertable group by name having usercount > 1

This will return a result like this:
username    usercount
Komal     5
Golu    10
Nidhi     3
Neha     2

So in above case, the user “Komal” is used 5 times and user “Golu” is user 10 times and so on

This is a good example of how to get a count of duplicate values for a MySQL table.

Please follow and like us:
0

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.