Thursday, November 23, 2006

SQL: Finding duplicate rows in table

Following SQL code snippet demonstrates finding duplicate rows in table:

SELECT SampleDescription,
COUNT(SampleDescription) AS Occurance
FROM SchedTimeOffType
GROUP BY SampleDescription
HAVING ( COUNT(SampleDescription) > 1 ) order by Occurance desc

No comments: