Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Data Query

Status
Not open for further replies.

nateDiggsCSU

Programmer
Joined
Jan 7, 2005
Messages
5
Location
US
I have a table that contains a large amount of duplicate data. I want to write a query that finds the entries that are duplicates and output them to a table. How can this be done?
 
One way:
SELECT A.* INTO newTable
FROM yourTable AS A
WHERE 1<(SELECT Count(*) FROM yourTable AS B WHERE B.DuplicateField=A.DuplicateField)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I need to do this with some data that is in an SQL Server 2000 table. I can't seem to get this to work with a view. Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top