📅  最后修改于: 2022-03-11 15:05:34.654000             🧑  作者: Mango
select d.StudentId, d.Name, d.Course, r1.result as Term1Result, r2.result as Term2Result
from StudentDetails d
left join StudentResults r1 on d.StudentId = r1.StudentId and r1.term = 1
left join StudentResults r2 on d.StudentId = r2.StudentId and r2.term = 2