title: What is the "best" way to get 3 different SUM using a single query in MYSQL
body: <p>This appears to be subjective but is not.</p>
  
  <p>Given:</p>
  
  <pre><code>Table with the ff. field:
  
   - userid
   - breakstart
   - breakend
   - minutes
   - breaktype
  </code></pre>
  
  <p>Goal:
  Get the <code>SUM()</code> of each type of break of a particular <code>user</code> inclusive of <code>breakstart</code> and <code>breakend</code></p>
  
  <p>What I've done so far:
  The simplest that I can think of is to do 3 separate queries, like so...</p>
  
  <pre><code>SELECT SUM(minutes) as totalbreak 
  FROM `breaklog`
  WHERE
      userid = &lt;some userid&gt;
        AND
      DATE(breakstart) = "2015-06-11"
        AND
      DATE(breakend) = "2015-06-11"
          AND
      breaktype = "1"
  # just feed breaktype with valid types i.e. ("1", "2", "3")
  </code></pre>
  
  <p>Am just trying to know if there is a better way to achieve my goal, probably with just one single query? Or is that even possible? Or is it better to get ALL <code>breaktypes</code> and do the filtering outside of the SQL engine, btw am using PHP in the backend.</p>
  
  <p>Thanks in advance for all the inputs.</p>