- Total Members: 220,035
- Threads: 525,391
- Posts: 977,006
-
December 10th, 2012, 02:55 PM
#1
Select and Delete from table of Dups
I have a table with Duplicates determined by 3 fields. There is no other way to get my data into this system....
What I need to do is create a query that will grab the first instance of each duplicate and delete it....
HOW can I do this?
Ex
ID Field 1 FIeld2 FIeld3
1 3445 10/10/2012 Good
2 3445 10/10/2012 Good
3 9889 5/5/2011 Fair
4 9889 5/5/2011 Fair
5 9889 5/5/2011 Fair
What I want left is
ID Field 1 FIeld2 FIeld3
1 3445 10/10/2012 Good
3 9889 5/5/2011 Fair
-
December 10th, 2012, 03:28 PM
#2
I have read that I can copy the Structure of the table and then make one field that I dont want duplicated and make that the Primary Key and then copy the records into that table...thus eliminating duplicates.....
But my table is defining the Duplicate records over a couple fields......not 1...can only assign one Primary Key....so that wont work.....can I do something similar but defining 3 or 4 fields to determine the Duplicate records?
-
December 10th, 2012, 03:43 PM
#3
Try compound primary key. Set multiple fields as primary key.
-
December 10th, 2012, 03:45 PM
#4
Thanks....
was just coming back to let you all know I think I figured it out....I created another field and simply concatonated the 3 fields into one.....then used this as a Primary Key...
Thanks
Similar Threads
-
By mcranda in forum Microsoft Access Help
Replies: 6
Last Post: May 24th, 2012, 11:23 AM
-
By LizSmith in forum Microsoft SQL Server
Replies: 2
Last Post: June 1st, 2010, 07:32 PM
-
By jaele in forum SQL Development
Replies: 7
Last Post: February 5th, 2010, 12:40 AM
-
By xtgeminiman in forum ASP Development
Replies: 6
Last Post: December 11th, 2005, 06:43 AM
-
By Chris@Home in forum Microsoft SQL Server
Replies: 1
Last Post: March 8th, 2004, 01:50 AM