title: SQL needed to get most popular product based also off a quantity
body: <p>I'm currently trying to get the most popular productID from my MSSQL Database. This is what the table looks like (With a bit of dummy data):</p>
  
  <p>OrderItems:</p>
  
  <pre><code>+--+-------+--------+---------+
  |ID|OrderID|Quantity|ProductID|
  +--+-------+--------+---------+
  | 1|      1|       1|        1|
  | 2|      1|       1|        2|
  | 3|      2|       1|        1|
  | 4|      2|      50|        2|
  </code></pre>
  
  <p>The OrderID field can be ignored, but I need to find the most popular ProductID's from this table, ordering them by how often they occur. The results set should look something like this:</p>
  
  <pre><code>+--------+
  |PoductID|
  +--------+
  |       2|
  |       1|
  </code></pre>
  
  <p>As ProductID 2 has a total quantity of 51, it needs to come out first, followed by ProductID 1 which only has a total quantity of 2.</p>
  
  <p>(Note: Query needs to be compatible back to MSSQL-2008)</p>