I'm using access 2007
I have 3 tables: entry authorization - roe_tbl, contact -contact_tbl, and address - addr_tbl.
the roe_tbl has ID, addrID, contactID and a few other fields.
the addr_tbl has ID and the streetno, streetname, addrtype.
addrtype is CNT for contact or ROE for authorization
the contact_tbl has ID, contact name, and addrID.
For each roe_tbl record there is 1 addr_tbl record with type="ROE" and 1 contact_tbl record. For each contact_tbl record there is 1 addr_tbl record with type="CNT"
How do I make a query to get the 2nd reference of the addr_tbl for the contact_tbl (the "CNT" address type record)? The sql for the query I have so far includes everything except the address info for the contact table. Currently it looks like this:
SELECT roe_tbl.*, address_tbl.*, contact_tbl.*
FROM contact_tbl RIGHT JOIN (address_tbl RIGHT JOIN roe_tbl ON address_tbl.addressID = roe_tbl.roeAddrID) ON contact_tbl.contactID = roe_tbl.roeContactID;
I have 3 tables: entry authorization - roe_tbl, contact -contact_tbl, and address - addr_tbl.
the roe_tbl has ID, addrID, contactID and a few other fields.
the addr_tbl has ID and the streetno, streetname, addrtype.
addrtype is CNT for contact or ROE for authorization
the contact_tbl has ID, contact name, and addrID.
For each roe_tbl record there is 1 addr_tbl record with type="ROE" and 1 contact_tbl record. For each contact_tbl record there is 1 addr_tbl record with type="CNT"
How do I make a query to get the 2nd reference of the addr_tbl for the contact_tbl (the "CNT" address type record)? The sql for the query I have so far includes everything except the address info for the contact table. Currently it looks like this:
SELECT roe_tbl.*, address_tbl.*, contact_tbl.*
FROM contact_tbl RIGHT JOIN (address_tbl RIGHT JOIN roe_tbl ON address_tbl.addressID = roe_tbl.roeAddrID) ON contact_tbl.contactID = roe_tbl.roeContactID;