title: Select distinct id when using sum on another column?
body: <p>An order can consist of several rows and so the OrderId is not unique. How can I do a SUM and not have to GROUP BY in order for the SQL to parse correctly?</p>
  
  <pre><code>SELECT DISTINCT OrderId, SUM(ProductPrice * ProductQuantity ) as Total
  FROM OrderDetails
  GROUP BY OrderId
  </code></pre>
  
  <p>If I take off the GROUP BY line then I get</p>
  
  <pre><code>'OrderDetails.OrderId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>My desired outcome is if an order consisted of 2 products then it should output both rows.</p>
  
  <p>The group by is outputting 1 row.</p>