import arcpy from arcpy import env env.workspace=r"Z:\GIS_Data\gdb\GIS_Test.gdb" fc="COA_FH_Inspections" cursor = arcpy.UpdateCursor(fc) idlist = [] datelist = [] for row in cursor: idlist.append(row.getValue('HydrID')) datelist.append(row.getValue('TestDate')) cursor.updateRow(row) print idlist print datelist idunique = set(idlist) #Make a layer from the feature class arcpy.MakeFeatureLayer_management(fc, "lyr") for i in idunique: if i == idlist: arcpy.SelectLayerByAttribute_management("lyr", "New_Selection", '"HydrID" = i') arcpy.SelectLayerByAttribute_management("lyr", "subset_Selection",'"TestDate" = (Select Max("TestDate") from "lyr"')
sample of what it is returning? there are dates in different formats, some are easier to deal with than others