此查询
SELECT
Student.StudentID,
student.`Name`,
attendance.Date,
CASE
WHEN attendance.StudentID IS NOT NULL THEN
'Present'
ELSE
'Absent'
END AS Attendance_Status
FROM
student
LEFT JOIN attendance ON student.StudentID = attendance.StudentID
给我这个结果
如何获得与此类似的结果
答案 0 :(得分:-1)
通过这个答案解决
选择student.StudentID,学生。
Name
,IF((选择DISTINCT 1 FROM出席地点) 出勤率.StudentID = student.StudentID AND date =' 2015-09-07' )= 1,'现在','缺席' )AS
2015-09-07
,IF((选择DISTINCT 1 FROM出席地点) 出勤率.StudentID = student.StudentID AND date =' 2015-09-14' )= 1,'现在','缺席' )AS
2015-09-14
,student.WorkshopID来自学生
@Hitesh Mundra