Select to view content in your preferred language

FGDB Select By Attributes — Subquery SELECT clause doesn't allow expressions

622
1
Jump to solution
01-20-2024 12:35 AM
Labels (1)
Bud
by
Honored Contributor

ArcGIS Pro 3.2.1; file geodatabase


In Select by Attributes, this works:

 objectid in (
    select
        objectid
    from
        species_records)

Bud_0-1705739433979.png

 

But this doesn't work:

objectid in (
    select
        objectid+0
    from
        species_records)

Bud_1-1705739534269.png

ERROR 000358: Invalid expression

Likewise, any other SQL expression throws the same error, including expressions on text or date fields.

 

Why does a SQL expression in the SELECT clause of a subquery throw an error in Select By Attributes?

I don't have that problem in mobile or enterprise geodatabases, only file geodatabases.

My example in this post is oversimplified for the purpose of demonstrating the issue. My real use case is to use Select By Attributes to select the greatest 1 per group (ties or no ties).


Related idea: FGDB Select By Attributes — Expressions in subquery SELECT clause

0 Kudos
1 Solution

Accepted Solutions
Bud
by
Honored Contributor

Esri Case #03533443 - FGDB Select By Attributes — Subquery SELECT clause doesn't allow expressions

"Esri Inc has informed me that this behavior you're seeing is expected behavior. The nature of how subqueries work and the very limited nature of its implementation in FGDBs means that only those comparison operators and set functions outlined in the documentation are supported.

https://pro.arcgis.com/en/pro-app/latest/help/mapping/navigation/sql-reference-for-elements-used-in-...

This explains why arithmetic operators, cast functions, string concatenation, and the like, fail validation in File Geodatabases. Using enterprise or mobile geodatabases is the suggested workaround."

 

View solution in original post

0 Kudos
1 Reply
Bud
by
Honored Contributor

Esri Case #03533443 - FGDB Select By Attributes — Subquery SELECT clause doesn't allow expressions

"Esri Inc has informed me that this behavior you're seeing is expected behavior. The nature of how subqueries work and the very limited nature of its implementation in FGDBs means that only those comparison operators and set functions outlined in the documentation are supported.

https://pro.arcgis.com/en/pro-app/latest/help/mapping/navigation/sql-reference-for-elements-used-in-...

This explains why arithmetic operators, cast functions, string concatenation, and the like, fail validation in File Geodatabases. Using enterprise or mobile geodatabases is the suggested workaround."

 

0 Kudos