title: Select sum of same column based on a condition
body: <p>I have a SQL table like this:</p>
  
  <pre><code>&gt;id|   date   |payed  |amount  
  &gt;1 |2015-02-02|1|5  
  &gt;2 |2015-02-02|0|2  
  &gt;3 |2015-02-02|1|4  
  &gt;4 |2015-03-02|1|1 
  </code></pre>
  
  <p>The payed column can be ether 0 or 1. How can I return the sum of "amount" for each option of "payed" (0 and 1) based on the date?</p>
  
  <pre><code>SELECT (sum of amount for both options of payed) FROM events WHERE date = ?
  </code></pre>
  
  <p>In the example above for date "2015-02-02" I should get 2 and 9.</p>
  
  <p>Thank you very much</p>