Join with definition query excludes row unexpectedly

178
1
Jump to solution
09-19-2024 11:09 AM
Labels (1)
Bud
by
Esteemed Contributor

ArcGIS Pro 3.3.1; mobile geodatabase or file geodatabase

 

Mobile Geodatabase:

I have TABLE_A:

Bud_0-1726769093166.png

And TABLE_B: 

Bud_1-1726769109937.png

I've hidden the OBJECTID fields from both attribute tables to remove visual clutter.

I want to join from TABLE_A to TABLE_B using the common ID fields. I want the join relationship to be one-to-first, not one-to-many. When it comes to "what related record to use from the join table" in the one-to-first join, I want to use the rows from TABLE_B where BINARY = 1.

Background: https://community.esri.com/t5/data-management-questions/1-m-join-to-pull-feature-with-specific-attri...

I apply a definition query to TABLE_B: WHERE BINARY = 1

Bud_2-1726769130324.png

Then I create the join:

Bud_3-1726769163295.png

But, due to the definition query being applied to the join, the row from TABLE_A where ID_A=3 has been excluded. That is expected since there is no matching row in TABLE_B where the ID is 3.

Bud_4-1726769189346.png

So, I will modify the definition query on the joined table to include ...OR ID_B IS NULL.

However, the new definition query excludes the row where ID_A=1. That's not expected.

Bud_5-1726769209228.png

Definition Query: main.TABLE_B.BINARY = 1 OR main.TABLE_B.ID_B IS null

I expected the attribute table of the join to look like this (using DBeaver 23.3.2 SQL client): 

Bud_6-1726769228187.png

select
    a.id_a,
    b.id_b,
    b.binary
from
    table_a a
left join
    table_b b   
    on a.id_a = b.id_b
where
    binary=1 or id_b is null
order by
    id_a

Question:

Why is the one-to-first join with the definition query  main.TABLE_B.BINARY = 1 OR main.TABLE_B.ID_B IS null  excluding the row where ID_A=1?

0 Kudos
1 Solution

Accepted Solutions
Bud
by
Esteemed Contributor

It appears to be a bug.

Esri Case #03704340 - ArcGIS Pro 3.3.1 - Join with definition query excludes row unexpectedly

BUG-000170869: Adding a definition query excludes a row of data when using Add Join geoprocessing tool in ArcGIS Pro

View solution in original post

0 Kudos
1 Reply
Bud
by
Esteemed Contributor

It appears to be a bug.

Esri Case #03704340 - ArcGIS Pro 3.3.1 - Join with definition query excludes row unexpectedly

BUG-000170869: Adding a definition query excludes a row of data when using Add Join geoprocessing tool in ArcGIS Pro

0 Kudos