sql - MS Access 2002/VBA - join a number of lookup tables to main query? -


consider:

contact ======= contact_id, not null name, not null electorate_id, null allowed member_type_id, null allowed  member_types ===========+ member_type_id member_type  electorates =========== electorate_id electorate 

these tables wish use populate form. have tried few ways, query returns no data:

select contact_id, name, member_type, electorate contact left join member_types  on contacts.member_type_id=member_types.member_type_id, contacts left join electorates on contacts.electorate_id=electorates.electorate_id 

also:

"select contact_id, name, member_types.member_type, electorates.electorate contacts, member_types, electorates contacts.contact_id=" & contact_id & "  , electorates.electorate_id=contacts.electorate_id , member_types.member_type_id = contacts.member_type_id" 

both of these fail. can suggest query works please?

select contact_id, name, member_type, electorate contact  left join member_types on contact.member_type_id=member_types.member_type_id left join electorates on contact.electorate_id=electorates.electorate_id 

don't re-specify contact table in row 4. have contacts in on clauses, not contact.

hopefully left joins supported in access 2002.

also, second query work if both electorate_id , member_id set. that's why need left join.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -