The Business Intelligence Blog

March 27, 2010

How to find duplicate rows in a table in SQL Server

Filed under: SQL Server Database — Tags: , — Shahfaisal @ 1:55 pm

To demonstrate this, I have a table with 2 duplicate rows as shown in the figure below:

And here is the query you can use to find out duplicate rows:

SELECT ProductID, ProductName, ProductNumber, Cost, NumberOfDuplicateRows=count(*)
FROM dbo.Product
GROUP BY ProductID, ProductName, ProductNumber,Cost
HAVING count(*) > 1



Advertisements

1 Comment »

  1. […] post: How to find duplicate rows in a table in SQL Server « The Business … Share this […]

    Pingback by How to find duplicate rows in a table in SQL Server « The Business … | Information Mining R&D — March 27, 2010 @ 2:28 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: