title: MySQL, how to do a sum by product and by month
body: <p>I have a table like below</p>
  
  <pre><code> Date        |  Product      |  Qty
  -------------|---------------|------
  12-Dec-12    | reference1    | 1
  14-Dec-12    | reference2    | 2
  14-Dec-12    | reference1    | 3
  1-Jan-13     | reference2    | 4
  3-Jan-13     | reference2    | 5
  3-Jan-13     | reference3    | 6
  </code></pre>
  
  <p>and I would like to get it as below through a query</p>
  
  <pre><code>Product    | Dec 2012   | Jan 2013
  ===========|============|========== 
  reference1 |    4       | 0
  reference2 |    2       | 9
  reference3 |    0       | 6
  </code></pre>
  
  <p>I know how to group already, my problem is how to have dynamic column (I would like to be able to choose last <code>6 months</code>, <code>12 months</code> or <code>24 months</code>).</p>