
ADO, Access97, and multiple left joins
Help. I am using ADO and have an access 97 database with 4 tables. I need
to select all of the records from all 4 tables which match a specified piece
of data. It is set up like this:
table1 contains unikey, somefield, and other fields
table2 thru 4 contain unique_id and other fields
in table 1 the unikey is unique (no duplicates), but in the other tables I
can have 0 or more records where the unikey from table 1 matches a value in
the unique_id field.
I get the somefield value from a list in a file - I then issue the following
select statement
SELECT * FROM table1 left JOIN (table2 left JOIN (table3 left JOIN table4 ON
table4.unique_id=table3.unique_id) ON table3.unique_id=table2.unique_id) ON
table2.unique_id=table1.unikey
WHERE (table1.somefield='somevalue')
ORDER BY (table1.transaction_date_yr & table1.transaction_date_mo &
table1.transaction_date_day) DESC
I don't get all of my records from the other tables. For instance, if I
have a matching record in table4, but none in table3, I don't get the ones
from table4. If I have matches in both, then I get both. I tried inner
join and right join, but they return nothing if any of the tables are
missing a match.