Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

SQL Query to Get Count of Duplicate Records

Jun 6, 2012
Introduction:

Here I will explain how to write a SQL query  to get duplicate records or Query to get count of duplicate records or rows in SQL Server or query to find duplicate records in SQL server.

Description:

In previous post I explained Query to alter table columns and Query to delete duplicate records in SQL Server. Now I will explain how to write SQL query to get duplicate records count that means how many times each duplicate record exists in datatable. In database I have one table that doesn’t contain any primary key column because of that duplicate records inserted in table that would be like this 

Now I want to know the duplicate records count that means how many times each duplicate record exists in datatable for that I written a query like this


SELECT Id,Name, COUNT(*) as DupeCount
FROM EmployeData
GROUP BY Id,Name
HAVING COUNT(*) > 1 Order By Id
After run above query we will get each record duplicate count that would be like this

 If you want to delete duplicate records or rows from datatable check this link Query to delete duplicate records in SQL server

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

4 comments :

Anonymous said...

You Develop a very good website..

Kulasekar said...

Can u please give example to redirect to gmail accout. I gmail username and gmail password only when they click gmail-Button it should redirect to gmail account. Please show with some example

Thanks in advance

Prasanta Kr. Biswas said...

Actually need to specified how to write code for C# checking duplicate record through entering text box

S.P. Gupta said...

my data contains where an employee is assigned to many projects while most of the employees are assigned only one project. My object is to report to management the names of persons assigned to more than one project. Please help to create suitable query in Access 2007

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.