B
Brad Granath
I have a table that stores [Unit ID] and [Inspection ID]. The table should
only have one instance of each [Unit ID]. The [Inspection ID] field is an
autonumber field. For every duplicate I would like to remove the older record
(the one having the smaller [Inspection ID]. This is a series of two
queries. The first copies the records, and the second deletes them from the
original table. I have written the first query as follows:
SELECT [Unit ID], INTO Inspections_Archive
FROM Inspections
WHERE ((Inspections.[Unit ID]) In (SELECT [Unit ID] FROM [Inspections] As
Tmp));
This, however, copies ALL duplicate records, rather than only the one record
with the smaller [Inspection ID]. How do I add this criterion to my WHERE
clause?
only have one instance of each [Unit ID]. The [Inspection ID] field is an
autonumber field. For every duplicate I would like to remove the older record
(the one having the smaller [Inspection ID]. This is a series of two
queries. The first copies the records, and the second deletes them from the
original table. I have written the first query as follows:
SELECT [Unit ID], INTO Inspections_Archive
FROM Inspections
WHERE ((Inspections.[Unit ID]) In (SELECT [Unit ID] FROM [Inspections] As
Tmp));
This, however, copies ALL duplicate records, rather than only the one record
with the smaller [Inspection ID]. How do I add this criterion to my WHERE
clause?