Saturday, May 2, 2015

How to find duplicate records in a table in SQL server

Introduction: In this article today I am going to explain how to find duplicate records in a table in SQL server

Description:

I have a table Student_Detail and having duplicate records.
  
find duplicate records in a table in SQL server


We can find the duplicate records of table using Group by clause. To find the duplicate records of table use the below given Query:

Select SudentName,Fee,StudentClass,StudentRollNo, count(*) as Duplicate from dbo.Student_Detail group by SudentName,Fee,StudentClass,StudentRollNo having count(*) >1


find duplicate records in a table in SQL server


We can also use the beloe given query to find the duplicate records:

Select SudentName,Fee,StudentClass,StudentRollNo from dbo.Student_Detail group by SudentName,Fee,StudentClass,StudentRollNo having (count(SudentName) >1)

find duplicate records in a table in SQL server

Is this article helpful for you?

If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

No comments:

Post a Comment