I have table like

enter image description here

I need to select if R_no values is more than two same values and in ANGLE select first three numbers common and more than three attributes is same

enter image description here

Finally I want to select like blue highlighted attributes.

closed as unclear what you're asking by ahmadhanb, Vince, Hornbydd, Erik, csk Apr 1 at 16:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • To select multiple instances of R_no: summary statistics with a summary field of FID/OBJECTID case field of R_no to create a table with counts, optionally use table select where count_FID > 1 to create a new table with just R_no values that have a count of more than 1 instance then join by attributes R_no to R_no in the summary table extract and then finally select where count_FID > 1, right click on the layer and choose create layer from selected features and then remove the join on the selection layer - this will leave you with a layer where all the rows have a instance of R_no more than 1. – Michael Stimson Apr 1 at 3:14
  • thanks sir, but it is to lengthy. And what about Angle select starting three letters same attributes if more than three values. – Rakesh Reddy Posham Apr 1 at 3:47
  • Again, you can use the same technique to select from the selected layer but this could be simplified with python and dictionaries using a search cursor then iterating the first dictionary by key to select the matching R_no, ANGLE and DIST; the two-from-three duplication match can be evaluated and selection added to an existing selection (starting from no selection) of a layer. This is fairly advanced python, do you have reasonable python ability? – Michael Stimson Apr 1 at 3:57
  • i don't have knowledge about python so could u please give VB Script querry for above. – Rakesh Reddy Posham Apr 1 at 4:31
  • I don't know VB Script, VB.net with ArcObjects I do know but that's far too much to write for a single question. Use Model Builder if you want this to be repeatable and save into a toolbox. – Michael Stimson Apr 1 at 4:37

Your question is a bit unclear. If you want to select first three rows if number of features in each R_no group is larger than two, code below should work. Execute in python window with the table/feature class added to the map. Im using collections.defaultdict to Group.

import arcpy
from collections import defaultdict

layer = 'somelayeraddedtoArcMap' #Change
group_field = 'R_no' #Change

oid_field = arcpy.Describe(layer).OIDFieldName
d = defaultdict(list)

#Group oids together by Group_field
with arcpy.da.SearchCursor(layer,[group_field, oid_field]) as cursor:
    for group, oids in cursor:

oids_to_select = []
for group, oids in d.iteritems(): #d.items() in python3/ArcGIS Pro
    if len(oids)>2: #if more than 2 in group
        oids_to_select.extend(oids[:3]) #:3 add first Three oids to list

sql = "{0} IN{1}".format(arcpy.AddFieldDelimiters(layer, oid_field), tuple(oids_to_select))

Not the answer you're looking for? Browse other questions tagged or ask your own question.