3

I am trying to select the smallest Directionality value based on a selection of two Workingspace values:

enter image description here

In the above picture, there are two "Jeffery's" selected, I want to then select the Jeffery with Directionality 2 (I.E. the smaller one) without using = 2. I know there is a max/ min SQL expression:

DIRECTIONALITY = (SELECT MIN( DIRECTIONALITY) FROM TableName)

But this returns no values when choosing the select from current selection method. HOWEVER, if I create a new selection, this SQL does return a selection of 1 (it selects the row where Directionality is 1).

Is there a way to tell ArcMap to select the smallest value of a previous selection based on a different field? Specifically in Model Builder.

2

Your current SQL expression does not return anything from the current selection because (SELECT MIN( DIRECTIONALITY) FROM TableName) always evaluates to 1, which is indeed the minimum value for the whole table. You need to take the minimum value from just the rows that meet the condition WORKINGSPACE = 'Jeffery' and you can do this in one selection instead of two. The following expression (which I am sure can be rewritten in a cleaner way) worked for me:

SELECT * FROM TableName WHERE DIRECTIONALITY = (SELECT MIN(DIRECTIONALITY) FROM TableName WHERE WORKINGSPACE = 'Jeffery')
  • Thanks so much that worked!! – Sarah Jul 11 at 14:59
  • @Sarah Glad to help. If it solved your question, you can mark this answer as the accepted answer. – Marcelo Villa Jul 11 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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