AnsweredAssumed Answered

deleting duplicate records using hierarchy

Question asked by jtrook on Jun 20, 2012
Latest reply on Jun 22, 2012 by jtrook
Greetings,

I am hoping someone can help me find an easy way to delete duplicate records in a table.  The problem is I need to follow an order/hierarchy for deleting duplicate records.  In my table (see image) I have identified the count/frequency to identify duplicate records.  I will either have a unique record, two duplicates, or three duplicates.  For the duplicate records I will always preserve Type "R" and delete the matching "C" and/or "H" Type records.  If I have duplicate records for "C" & "H" types (but not "R") then I keep "C" and delete "H".  Duplicate records with a "H" type will always be deleted.

My stumbling point is how to loop through the records and save "C" type records if their associated duplicate record is a "H" type or
delete "C" type records if their associated duplicate record is a "R" type (see highlighted records in table).

I've tried using search cursors to loop through the records and using some query statements but my logic isn't quite right when it comes to comparing duplicates and identifying what record to keep or delete.

[ATTACH=CONFIG]15357[/ATTACH]

Does anyone have some ideas to simply this process or a script example?
Thanks,
Jason

Attachments

Outcomes