Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Finding Duplicates

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-03-13 : 13:13:49
I would like to add the PIC field to this stored procedure so I can find the duplicates.

SELECT claim, pic,
COUNT(claim) AS NumOccurrences
FROM sheet1$
GROUP BY claim
HAVING ( COUNT(claim) > 1 )

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-13 : 14:24:07
[code]
SELECT s.claim, s.pic,c.NumOccurrences
FROM sheet1$ s
INNER JOIN
(SELECT claim,
COUNT(claim) AS NumOccurrences
FROM sheet1$
GROUP BY claim
HAVING ( COUNT(claim) > 1 )
)c
ON c.claim = s.claim
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-03-13 : 14:38:35
Thank you!!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-14 : 00:21:31
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -