DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Senthil has posted 1 posts at DZone. View Full User Profile

Find Duplicate records in SQL table

06.25.2012
| 29257 views |
  • submit to reddit
Suppose our tablename is masterorder with column orderid for which we are goin to find duplicate records.
SELECT orderid, COUNT(*) TotalCount
FROM masterorder
GROUP BY orderid
HAVING COUNT(*) > 1

U might have come across a situation like there are number of duplicated records in a table.
Now Its Ur duty to remove duplicacy of data from the table, So the first step would be to find out duplicate records against each column.