title: Sum by month and put months as columns
body: <h3>Background</h3>
  
  <p>I have time series data on a monthly basis and I would like to sum values for each ID, grouped by month and then have the month names as columns rather than as rows.</p>
  
  <h3>Example</h3>
  
  <pre><code>+----+------------+-------+-------+
  | id | extra_info | month | value |
  +----+------------+-------+-------+
  | 1  | abc        | jan   | 10    |
  | 1  | abc        | feb   | 20    |
  | 2  | def        | jan   | 10    |
  | 2  | def        | feb   | 5     |
  | 1  | abc        | jan   | 15    |
  | 3  | ghi        | mar   | 15    |
  </code></pre>
  
  <h3>Desired Result</h3>
  
  <pre><code>+----+------------+-----+-----+-----+
  | id | extra_info | jan | feb | mar |
  +----+------------+-----+-----+-----+
  | 1  | abc        | 25  | 20  | 0   |
  | 2  | def        | 10  | 5   | 0   |
  | 3  | ghi        | 0   | 0   | 15  |
  </code></pre>
  
  <h3>Current Approach</h3>
  
  <p>I can easily group by month, summing the values. Which gets me to:</p>
  
  <pre><code>-----------------------------------
  | id | extra_info | month | value |
  +----+------------+-------+-------+
  | 1  | abc        | jan   | 25    |
  | 1  | abc        | feb   | 20    |
  | 2  | def        | jan   | 10    |
  | 2  | def        | feb   | 5     |
  | 3  | ghi        | mar   | 15    |
  </code></pre>
  
  <p>But I now need those months as column names. Not sure where to go from here.</p>
  
  <h3>Additional Information</h3>
  
  <ul>
  <li>In terms of language, this query is to be run in postgres.</li>
  <li>The months above are just examples, obviously the real data set is much larger and covers all 12 months across thousands of IDs</li>
  </ul>
  
  <p>Any ideas from an SQL guru very much appreciated!</p>