select s.studentName as 学生姓名, sum(c.late) as 迟到, sum(c.leave) as 早退 from student s inner join check c on s.studentID = c.studentID group by s.studentName
哈哈,"棉花糖ONE"是正解,要用 left join才能求出所有的学生;我稍做修改如下: select s.studentName,sum(c.late),sum(c.leave) from student s left join check c on c.studentID=s.studentID group by s.studentName