I have a field which is supposed to hold a unique identifier, however due to issues with Attribute Assistant I have multiple features which have the same unique ID. I want to write a script which will select duplicates and remove the originals from the selection. The duplicated field is FID, the originals will have a lower OID (also, there can be more than one duplicate).
I have used SelectLayersByAttribute_management to select features where there are more than one feature with the same FID:
arcpy.SelectLayerByAttribute_management("MyLayer", "NEW_SELECTION", "FID In (SELECT FID FROM MyFeatureClass GROUP BY FID HAVING Count(*)>1))
This selects both originals and duplicates, but how do I now remove the features which have the original FID value?
The originals will have a lower OID value:
OID FID 1 x101 ORIGINAL 2 x101 DUPLICATE 3 x102 ORIGINAL 4 x102 DUPLICATE 5 x102 DUPLICATE
I'm using ArcMap 10.2.1