title: Returning multiple columns and grouping by month
body: <p>I have three tables products, sales and costs.</p>
  
  <p>The sales and products table each have a costs field of type decimal and a date field of type date.</p>
  
  <p>Additionally, the sales table has a productname field, which is matched to a productname field in the products tables.</p>
  
  <p>The products table also has a category field.</p>
  
  <p>I want to select all sales and all purchases for each month, and display them in separate columns grouped by month, up until the current year.</p>
  
  <p>Something like the following</p>
  
  <pre><code>            Sales  Purchases
  
  January      100      50
  Febuary      100      50
  March        100      50
  April        100      50
  May          100      50
  June         100      50
  July          30      50
  </code></pre>
  
  <p>The purchases table is not related to any other table.</p>
  
  <p>However, the sales table productname field only contains products that exist in the products.productname.</p>
  
  <p>I want to add on to the end of my query</p>
  
  <p>WHERE sales.productname=products.productname AND category='Food'</p>
  
  <p>I am unsure how to return multiple columns, sum them for each month, and then group them by month.</p>
  
  <p>I asked something similar here, and took a solution however it returned sales and purchases together in one column. </p>
  
  <p>How would I keep them as separate columns?</p>