title: Getting sum of multiple columns and calculate each row's ratio
body: <p>Below, is the schema of my brand_of_items table. For simplicity, shown here with two columns: id (primary and AI), symbol (varchar 50, unique)</p>
  
  <pre><code>Table - brand_of_items
  id   symbol
  0    a
  1    b
  2    c
  ..   ..
  10   j
  </code></pre>
  
  <p>Below, is the schema of my items_of_brand.   </p>
  
  <pre><code>Table - mainIndexQuantity
  id  brand_of_items_id   vol  item_type  salefinalizeddate
  0         1              5      0       2005-5-11
  1         1              6      0       2004-5-11
  2         1              7      0       2011-5-11
  3         1              8      0       2011-5-12
  4         1              9      0       2011-5-12
  5         1              10     0       2011-5-11
  6         1              5      1       2012-5-11
  7         1              6      1       2012-5-11
  8         1              7      1       2011-5-11
  9         1              8      1       2010-5-12
  10        1              9      1       2012-5-12
  11        1              10     1       2005-5-12
  </code></pre>
  
  <p>The mainIndexQuantity table brand_of_items_id columns is a foreign key which points to brand_of_items (id).
  The mainIndexQuantity table item_type column is not a foreign key, which it should be.</p>
  
  <p>The two item types are: 0 = retail and 1 = wholesale</p>
  
  <p>I want to calculate the ratio of the types of items (retail vs wholesale) per each_brand_of_items table entry. The goal is to see if the a brands item is selling more in retail or wholesale.</p>
  
  <hr>
  
  <p>**
  Adding Complexity:
  I want to add a date column to mainIndexQuantity table and want to find out the <strong>difference</strong> in sum of RetailVolume and WholesaleVolume and group the results by salefinalizeddate field.</p>
  
  <p>This is to help determine what items in what seasons sold more and the (delta) difference in sum of RetailVolume &amp; WholeSaleVolume will help to select items to pay most attention to. </p>