title: How to do sum of product of two columns in postgres and group by two columns?
body: <p>I have a table named "Inventory" that looks looks like this:</p>
  
  <p>date, store_id, item_num, description, on_hand, on_order, sold, cost, price</p>
  
  <p>I want to output something like this:</p>
  
  <pre><code>date | store_id | inv costs| total on_hand
  2014-08-03 | 100 | $57456 | 5876
  2014-08-03 | 101 | $76532 | 4565
  2014-07-27 | 100 | $12353 | 5346
  2014-07-27 | 101 | $65732 | 8768
  </code></pre>
  
  <p>by grouping with date AND only showing store ids of '100' and '101'. The inventory cost is the part I can't figure out - I want to find the cost of inventory for those stores in those dates therefore i want to sum up all the on_hand*costs. Any help would be appreciated, thanks!</p>