Thursday, September 16, 2004

SQL query to identify list of duplicate rows

First technical post. I am going to make it a bit lighter fare. The following SQL script example shows how to identify duplicate rows in a data table.

SELECT col1, col2, count(*)
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1

The query was ripped from a Microsoft article, which has further information on how to remove duplicate rows.
http://support.microsoft.com/default.aspx?scid=kb;en-us;139444

4 Comments:

Blogger Fireblayde said...

Cheers man. Very useful

January 2, 2008 at 9:11 PM  
Blogger Michele said...

Thank you:)

February 11, 2010 at 1:53 AM  
Blogger James Smith said...

Really a nice info friend. Thanks for sharing it.

James Williams from TechGlobeX

November 8, 2011 at 9:28 AM  
Blogger PraveenKumar said...

Nice.But if there are multiple columns with duplicate rows.........

October 31, 2012 at 9:23 AM  

Post a Comment

<< Home