title: Use AVG & Count together
body: <p>I am needing to take a average amount of sales.  But when I try to execute my query I get this error (again :( )
  Msg 130, Level 15, State 1, Line 2
  Cannot perform an aggregate function on an expression containing an aggregate or a subquery.</p>
  
  <p>Here is what I am attempting to run</p>
  
  <pre><code>Select SalesMan,
  COUNT(CASE WHEN SalesMan IN ('Richard', 'Jose', 'Mendez') AND supCheck IS NOT NULL AND ordered IS      NOT NULL THEN AVG(price1+price2+price3+price4+price5) ELSE NULL END)
  FROM PixieStick.dbo.SalesInfo
  GROUP BY SalesMan
  ORDER BY SalesMan ASC
  </code></pre>