我有三张桌子
students_first_semester_mark (StudentdID,Subject, Semester_I_Mark )
students_second_semester_mark (StudentdID,Subject, Semester_II_Mark )
students_third_semester_mark (StudentdID,Subject, Semester_III_Mark )
我想要以下输出:
_________________________________________________________________________________
|StudentdID | Subject | Semester_I_Mark| Semester_II_Mark | Semester_III_Mark
_________________________________________________________________________________
请注意,
Semester_I_Mark
或Semester_II_Mark
可能具有Null值。我渴望您的回答。
最佳答案
这是你想要的吗?
SELECT [students_first_semester_mark].[StudentdID]
,[students_first_semester_mark].[Subject]
,[students_first_semester_mark].[Semester_I_Mark]
,[students_second_semester_mark].[Semester_II_Mark]
,[students_third_semester_mark].[Semester_III_Mark]
FROM [students_first_semester_mark]
JOIN [students_second_semester_mark] ON [students_second_semester_mark].[StudentdID] = [students_first_semester_mark].[StudentdID]
JOIN [students_third_semester_mark] ON [students_third_semester_mark].[StudentdID] = [students_second_semester_mark].[StudentdID]