title: Msg 8120, Level 16, State 1, Line 1 SQL
body: <p>I've searched around and did see a question about this error however I can still not seem to manage to find the right way to write it, I keep getting an error for this code, what is wrong with the group by?</p>
  
  <pre><code>SELECT
      orders.customerid, orderdetails.orderid, 
      AMOUNT = unitprice * quantity 
  FROM 
      orderdetails
  JOIN 
      orders ON orders.orderid = orderdetails.orderid 
  GROUP BY 
      orders.customerid, orderdetails.orderid
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Msg 8120, Level 16, State 1, Line 1<br>
    Column 'xyz' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause</p>
  </blockquote>