Access Compare records in same access table

Joined
Mar 20, 2018
Messages
1
Reaction score
0
I need to compare field "doc_num_cd" in my table "Parts" to find any duplicate document numbers. If a duplicate is found I need to compare the field "last_update_dte" and move the record with the oldest date to a table "Parts_History".

I think I have the compare code:

SELECT *

FROM Parts

WHERE Doc_Num_Cd IN (SELECT Doc_Num_Cd FROM Parts GROUP BY Doc_Num_Cd HAVING COUNT(Doc_Num_Cd) > 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top