Forum Discussion
sarahjane2046
Jul 01, 2022Copper Contributor
Missing data when joining tables in a query?
I'm brand new to Access, so not sure if I'm even asking the right question. I have one Table, tblStudents, that has many rows of students with columns such as student ID, student name, student me...
- Jul 01, 2022
First a bit of fiddly terminology accuracy.
"Cells" are in Excel and Word. In Access, you have "Fields" in tables, not cells.You have an INNER JOIN, which as you realize only returns records which match on MentorID.
If you want to return ALL records from one table, and only MATCHING records from the other table, you need to use an OUTER JOIN.
George_Hepworth
Jul 01, 2022Silver Contributor
First a bit of fiddly terminology accuracy.
"Cells" are in Excel and Word. In Access, you have "Fields" in tables, not cells.
You have an INNER JOIN, which as you realize only returns records which match on MentorID.
If you want to return ALL records from one table, and only MATCHING records from the other table, you need to use an OUTER JOIN.
- sarahjane2046Jul 01, 2022Copper ContributorI've changed my SQL to
FROM tblStudents LEFT JOIN tblStudents ON tblStudents.MentorID=tblMentors.MentorID;
However, it says that there is a syntax error in the JOIN statement? I feel like I'm missing something obvious- sarahjane2046Jul 01, 2022Copper ContributorFROM tblStudents LEFT OUTER JOIN tblStudents ON tblStudents.MentorID=tblMentors.MentorID;
Also causes a syntax error- sarahjane2046Jul 01, 2022Copper ContributorNevermind, I'm dumb
FROM tblStudents LEFT OUTER JOIN tblMentors ON tblStudents.MentorID=tblMentors.MentorID;
- sarahjane2046Jul 01, 2022Copper ContributorThank you so much!