O
Opal
I am trying to create a query that will delete
a duplicate record in a table. I want to delete
the older record and keep the new one created.
I have used the Find Duplicates Query Wizard
but I am not getting the desired results and I
think its due to the parameters I am adding.
Below is my SQL:
DELETE MSCompl.MSComplID, MSCompl.SupName,
MSCompl.SupLink, MSCompl.CompletionDate,
MSCompl.Shift, MSCompl.GroupName, MSCompl.
MSCourseID, MSCompl.Deficiency
FROM MSCompl
WHERE (((MSCompl.SupLink)=[Forms]![HoldingInfo]![
txtHoldSupNumber]) AND ((MSCompl.CompletionDate)
Is Null Or (MSCompl.CompletionDate)<Date()) AND
((MSCompl.MSCourseID) In (SELECT [MSCourseID]
FROM [MSCompl] As Tmp GROUP BY [MSCourseID]
HAVING Count(*)>1 )));
Can someone help me create a query that will only
delete the older duplicate record? Could I take advantage
of the Primary key and remove the duplicate record that
has the lower primary key #?
a duplicate record in a table. I want to delete
the older record and keep the new one created.
I have used the Find Duplicates Query Wizard
but I am not getting the desired results and I
think its due to the parameters I am adding.
Below is my SQL:
DELETE MSCompl.MSComplID, MSCompl.SupName,
MSCompl.SupLink, MSCompl.CompletionDate,
MSCompl.Shift, MSCompl.GroupName, MSCompl.
MSCourseID, MSCompl.Deficiency
FROM MSCompl
WHERE (((MSCompl.SupLink)=[Forms]![HoldingInfo]![
txtHoldSupNumber]) AND ((MSCompl.CompletionDate)
Is Null Or (MSCompl.CompletionDate)<Date()) AND
((MSCompl.MSCourseID) In (SELECT [MSCourseID]
FROM [MSCompl] As Tmp GROUP BY [MSCourseID]
HAVING Count(*)>1 )));
Can someone help me create a query that will only
delete the older duplicate record? Could I take advantage
of the Primary key and remove the duplicate record that
has the lower primary key #?