Just for fun I tried it out and here's what I came up with.
I created 4 tables:
Code:
tblStudents
ID
Student
Code:
tblTeachers
ID
Teacher
Code:
tblNotes
ID
TableID
RecordID
Notes
Sample data was inserted into each table. For tblNotes I assume that RecordID relates to either the Teacher's ID or the Student's ID. If I want to display the Notes from the Student Barry Borshki, his Name and the Name of the table Student's name came from the query would look like this:
Code:
SELECT tblStudents.Student, tblNotes.Notes, TableID.Name
FROM tblStudents, tblNotes, TableID
WHERE tblNotes.TableID=TableID.ID
AND tblNotes.RecordID=tblStudents.ID
AND tblStudents.ID=2
AND TableID.ID=1
You can use LEFT JOIN, RIGHT JOIN, OUTER JOIN, but I have not learned them and the above query works just fine and is easier for me to understand
.
Bookmarks