select *,Count(A.student_id) as NumberInClass from student S inner join attendance A on S.student_id = A.student_id
inner join course C on C.course_id = A.course_id
Where attendance_date between "2005-09-26" and "2005-09-30"
Group by A.course_id
ปล* ค่า วันที่ หาเอามาใส่เองนะครับ อันนี้ผมสมมุติ
================================
Student
===============================
student_id Name
001 A
002 B
003 C
=================================
Course
=================================
course_id course_name
MATH001 แคลคูลัส 1
MATH002 แคลคูลัส 2
================================
select *,Count(A.student_id) as NumberInClass from student S inner join attendance A on S.student_id = A.student_id
inner join course C on C.course_id = A.course_id
Where attendance_date between "2005-09-26" and "2005-09-30"
Group by A.course_id
Having Count(A.student_id) > 0