title: Class Monthly Attendance Report By Date Range Using MYSQL
body: <p>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.</p>
  <p><a href="https://i.stack.imgur.com/VAkc0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VAkc0.png" alt="enter image description here" /></a></p>
  <p>I was able to get the desired output I want using PIVOT with this query:</p>
  <pre><code>SELECT DISTINCT
  tbl_subjectattendance.student_id,
  COALESCE((
      CASE WHEN tbl_subjectattendance.Date = &quot;2017-08-30&quot; THEN tbl_subjectattendance.status END), &quot;-&quot;) AS &quot;2017-08-30&quot;, COALESCE(( CASE WHEN tbl_subjectattendance.Date = &quot;2017-08-31&quot; THEN tbl_subjectattendance.status END), &quot;-&quot;) AS &quot;2017-08-31&quot; FROM tbl_subjectattendance WHERE `section_id` = &quot;ST. AUGUSTINE&quot;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/NuT26.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NuT26.png" alt="enter image description here" /></a></p>
  <p>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.</p>