ArcGIS 3.0.2: What tool can select the records with the highest values in a particular field?
For example, in the screenshot below, I couldn’t figure out which tool can select the FOUR records with the highest population size in the “population” field
Solved! Go to Solution.
I wonder if this would work in your model:
Maybe that's the kind of thing @MErikReedAugusta had in mind in my ROW_NUMBER idea.
Somewhat related: Adding sequential numbers for the selected features
I had considered that approach too as it works just as well, the only "issue" would be that sort creates an output table and the user would need to deal with that (i.e. keep it or delete it). If I had taken this route I would probably have written it to an in-memory workspace.
Anyway nice to have shown two solutions for the question!
Many thanks guys for the help. It works fine
Top-n in primitive database (file geodatabase)
It's kind of brute force elimination and probably won't work right if there are rows with exact same value in population field.
population = (select max(population) from cities) or population = (select max(population) from cities where population < (select max(population) from cities)) or population = (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities))) or population = (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities))))
I can live with the "sort" and "select" tools to find the records with the top values. However, this may not work correctly if two of the top records have the same value.