Select to view content in your preferred language

SQL queries on attributes

577
1
11-08-2022 02:58 AM
Labels (2)
MaxenceMELIN
Emerging Contributor

Hi !

I try to automatize quality tests on data (mostly on attributes), the idea is to play python scripts every 2 weeks on 4 datasets in order the 4 data managers can see the warnings on differnt layers/tables and can improve regularly the quality of their data.

What is amazing, is that I did some SQL queries (in "select by attributes") that work on SDE layers but not on my geodatabase layers !!!

my problem is with UNION

I did a query like this one :

WHERE attribute IN (SELECT aa.... UNION SELECT bb.....)

on SDE layers this query works fine

On GDB layers I can do :

WHERE attribute IN (SELECT aa.... )
WHERE attribute IN (SELECT bb.....)

but

WHERE attribute IN (SELECT aa.... UNION SELECT bb.....)

doesn't work ... I cannot understand why !

Do you have some explanations ?

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

it might be explained by the differences discussed here

SQL reference for query expressions used in ArcGIS—ArcGIS Pro | Documentation


... sort of retired...