I've set up a Model in ArcGIS ModelBuilder (ArcMap 10.6) which select some rows of table "Rivers". Then i want to select the River with the Max-Value of Field "Diff" out of the selected Rows (not the whole Dataset). I tried to use "Select Layer by Attribute" with the following Expression

"Diff"= (Select MAX("Diff") FROM "Rivers")

it looks like the subquery selects "MAX" from the whole Dataset and not from my selection.

How do I extract the Max-Value from my selection?

  • The table is a shapefile, file geodatabase or what format? See: desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/…
    – BERA
    Nov 25 at 12:57
  • I've come across this issue before, I don't believe the subquery honours a selection. You need to export your selection to a temporary dataset in the same workspace then subquery that.
    – Hornbydd
    Nov 25 at 15:21
  • The table is a Feature Layer in a File Geodatabase so Subquery is already running, but not just on the selection. My problem with an export is that i need this subquery in a model, so it would produce 20'000 datasets
    – GISDani
    Nov 25 at 16:05
  • Why would exporting a selection create 20,000 datasets? Did you mean 20,000 rows in a single dataset?
    – Hornbydd
    Nov 25 at 16:35
  • I have to process 20'000 different selections, on every selection will the subquery run
    – GISDani
    Nov 25 at 19:38

Your Answer

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

Browse other questions tagged or ask your own question.