papadilbert
Programmer
I have a table that contains rows. (duh)
The rows have String fields and a few Long fields.
The Long fields reference the IDs of related table rows.
So far .. nothing unusual.
I created a query using the design tool. I designated that I want the query to return all of the rows matching one of the String fields and return not ID's of the related tables rows, but a field in the related row.
Still... nothing unusual. Just standard stuff. The query tool constructed the sql with the correct SELECT statement, JOIN statements, WHERE statement, etc.
When I execute the query, I get all of the matching rows returned only when there is an ID in the referenced ID fields. If, in a row, a referenced ID field = 0, that row does not get returned on the SELECT.
For example:
Table_A
StreetAddress as String
StateID as Long
Table_B
ID as Long
StateName as String
Table_A Rows:
123 ABC Street , 1
123 ABC Street , 0 'This one does not get returned on SELECT
123 ABC Street , 2
Table_B Rows:
1 , ALABAMA
2 , ALASKA
3 , ARIZONA
4 , ARKANSAS
If I:
SELECT Table_A.StreetAddress; Table_B.StateName WHERE Table_A.StreetAddress = "123 ABC Street"
I only get 2 rows returned. The row with the 0 as the StateID does not get returned.
I need all three rows returned even if there is no StateID. Do I need to add something to my sql to specify that a row with no StateID reference is OK?
The rows have String fields and a few Long fields.
The Long fields reference the IDs of related table rows.
So far .. nothing unusual.
I created a query using the design tool. I designated that I want the query to return all of the rows matching one of the String fields and return not ID's of the related tables rows, but a field in the related row.
Still... nothing unusual. Just standard stuff. The query tool constructed the sql with the correct SELECT statement, JOIN statements, WHERE statement, etc.
When I execute the query, I get all of the matching rows returned only when there is an ID in the referenced ID fields. If, in a row, a referenced ID field = 0, that row does not get returned on the SELECT.
For example:
Table_A
StreetAddress as String
StateID as Long
Table_B
ID as Long
StateName as String
Table_A Rows:
123 ABC Street , 1
123 ABC Street , 0 'This one does not get returned on SELECT
123 ABC Street , 2
Table_B Rows:
1 , ALABAMA
2 , ALASKA
3 , ARIZONA
4 , ARKANSAS
If I:
SELECT Table_A.StreetAddress; Table_B.StateName WHERE Table_A.StreetAddress = "123 ABC Street"
I only get 2 rows returned. The row with the 0 as the StateID does not get returned.
I need all three rows returned even if there is no StateID. Do I need to add something to my sql to specify that a row with no StateID reference is OK?