title: Get Sub total, total and grand total report in php from mysql data
body: <p>I need to find out :</p>
  
  <p>1) How many total entries have done by a particular user on a date 
  2) How many total entries have been done on a particular date.</p>
  
  <p>I am able to run this query :</p>
  
  <pre><code>SELECT app_user,DATE(app_doe),COUNT(*) AS entries,`institution`,`qualification` FROM `details` WHERE MONTH(app_doe)="12" AND YEAR(app_doe)="2017" GROUP BY app_user,DATE(app_doe),`institution`,`qualification` ORDER BY DATE(app_doe) DESC,app_user
  </code></pre>
  
  <p>and get the following output from the mysql table.</p>
  
  <p><a href="https://i.stack.imgur.com/6vtr5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6vtr5.png" alt="enter image description here"></a></p>
  
  <p>I need to arrange data in a report based on the above mysql query output like this using php , but i am not getting any idea how to count total,subtotals as mentioned above :</p>
  
  <p><a href="https://i.stack.imgur.com/IVrHA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IVrHA.png" alt="enter image description here"></a></p>
  
  <p>Please provide pointers on how to go ahead ...</p>