- 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)
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)