title: SQL Server query to find the total price of all the products by order
body: <p>I have a table Orders with <code>(id,orderCode,productId,quantity,color,size)</code>
  where I can have entries like:</p>
  
  <pre><code>1,O20100812,163,2,BLUE,Medium
  1,O20100812,163,3,BLUE,Larger
  1,O20100812,145,4,RED,Large etc
  1,O20100815,134,5,RED,Large etc
  1,O20100815,143,2,BLACK,Large etc
  1,O20100815,112,8,BLACK,Large etc
  </code></pre>
  
  <p>And another table Products with <code>(id,name,price)</code></p>
  
  <p>What I want is to find the total price of all the products in the order with orderCode 020100812. Should I DISTINCT select the order code and then SUM the quantity while JOINing the products table?</p>