3表以上 的 join 查询
在Access中, 每次join完都要 添加括号才能继续 join
select * from ((tbresident left join tbsingleold on TBResident.residentid=tbsingleold.residentid) left join tbwillparent on TBResident.residentid=tbwillparent.residentid)
最后可以添加 where 语句
//tbresident是主表 ,其余4个表是从表 (主表left join 4个从表)
select * from (((tbresident left join tbsingleold on TBResident.residentid=tbsingleold.residentid) left join tbwillparent on TBResident.residentid=tbwillparent.residentid) left join tbdisease on TBResident.residentid=tbdisease.residentid) left join tbprotected on TBResident.residentid=tbprotected.residentid where TBResident.residentid=1
//left join, right join, inner join的区别:
left join 返回左表全部记录
right join 返回右表全部记录
inner join 返回所有记录