外部连接超过2个表访问

时间:2015-03-23 12:55:09

标签: ms-access outer-join

关注this帖子后。我收到错误" JOIN操作中的语法错误"

这是我的查询

SELECT 
    StudentMaster.Student_id, 
    ExamDetails.Subject_id, 
    SubjectMaster.Subject_id 
FROM 
    (StudentMaster 
     LEFT OUTER JOIN ExamDetails 
       ON StudentMaster.Student_id = ExamDetails.Student_id) 
    LEFT OUTER JOIN ExamDetails 
      ON SubjectMaster.subject_id = ExamDetails.Subject_id

任何有关这方面的帮助都是可以理解的

1 个答案:

答案 0 :(得分:0)

你试过这个。

select s.Student_id,e.Subject_id,sub.Subject_id
from YourDatabaseName.SubjectMaster as sub 
left outer join YourDatabaseName.ExamDetails as e 
    on sub.Subject_id=e.Subject_id
left outer join YourDatabaseName.StudentMaster as s
    on s.Student_id=e.Student_id
group by s.Student_id
order by s.Student_id;