Tuesday, February 14, 2012

Display Duplicates Entry from Sql Server

Hello,

I like to ask if anyone knows the sql statement to display all the field of a record from a table only showing the duplicates, and my criteria of duplicate is that a record has two fields with the same data. Thanks in advance.

Regards,

stealthnet

This one would show the field, and count of occurrences when there are more than one occurrence of that field in the table.

SELECT field, count(*) FROM table
GROUP BY field
HAVING (count(*) > 1)

|||

Thanks!

No comments:

Post a Comment