title: Formatting returned value to 2 decimal places in mySQL
body: <p>I have the query below that retrieves data from my database on which it sums up all values and divide it to 60 to convert it to hours:</p>
  
  <pre><code>SELECT date(att.`date`) as dtDate, 
  (select sum(early_leave) from `attendance` where `attendance`.early_leave
  &gt; 0 and date(`attendance`.`date`) = date(att.date)) / 60 as EL
  
  FROM `attendance` as att 
  
  where date(att.`date`) BETWEEN '2018-08-9' and '2018-08-23'
  group by date(att.`date`)
  order by date(att.`date`)
  </code></pre>
  
  <p>It's output is like this:</p>
  
  <p><a href="https://i.stack.imgur.com/o0DIB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o0DIB.jpg" alt="output 1"></a></p>
  
  <p>And now, I want it to format with 2 decimal places, so I do:</p>
  
  <pre><code>SELECT date(att.`date`) as dtDate, 
  (select format(sum(early_leave),2) from `attendance` where `attendance`.early_leave
  &gt; 0 and date(`attendance`.`date`) = date(att.date)) / 60 as EL
  
  FROM `attendance` as att 
  
  where date(att.`date`) BETWEEN '2018-08-9' and '2018-08-23'
  group by date(att.`date`)
  order by date(att.`date`)
  </code></pre>
  
  <p>But why some of the outputs are like this: </p>
  
  <p><a href="https://i.stack.imgur.com/lQPnA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lQPnA.jpg" alt="output 2"></a></p>
  
  <p>I'm expecting the second value on <code>2018-08-10</code> to be <code>28</code> and so on. Does somebody knows why is it happening like this? Or am I formatting it the right way?</p>