I have a problem generating a monthly attendance report in each class of students. I have this table that stores all the attendance of student.
I was able to get the desired output I want using PIVOT with this query:
SELECT DISTINCT
tbl_subjectattendance.student_id,
COALESCE((
CASE WHEN tbl_subjectattendance.Date = "2017-08-30" THEN tbl_subjectattendance.status END), "-") AS "2017-08-30", COALESCE(( CASE WHEN tbl_subjectattendance.Date = "2017-08-31" THEN tbl_subjectattendance.status END), "-") AS "2017-08-31" FROM tbl_subjectattendance WHERE `section_id` = "ST. AUGUSTINE"
But I also want to make the dates dynamic. A date range to be exact, but how do I do it? What should I add on my query to make the dates dynamic? I badly need your help.