我有四张桌子
student
-------
id, int
firstName, varchar
lastName, varchar
course
------
id, int
name, varchar
semester
--------
id, int
name, varchar
mark
----
studentId, int
courseId, int
semesterId, int
mark, int
我想做一个 sql 查询来检索表firstName
中lastName
的每一行。courseName
semesterName
mark
mark
我试图用 INNER JOIN 来做,但我不能为不止一张桌子做 INNER JOIN。
我终于达到的那个代码
select student.firstName, student.lastName, course.name, semester.name, mark.mark
from mark
INNER JOIN student ON student.id = mark.studentId
INNER JOIN course ON course.id = mark.courseId
INNER JOIN semester ON semester.id = mark.semesterId