Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get count of duplicate values from table in mysql?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 606
    Comment on it

    Sometimes we need to check how many duplicate values a column has in MySQL table. We can do this by using "group by" and "having".

    Example: Suppose you have a table "user" with "fist_name" column from which you want to find all the records which have duplicate values in column "first_name" then you just need to write the below command

    select first_name, count(first_name) from user group by first_name having count(first_name) > 1;
    

    the above command will return all the records having duplicate first_name.

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: