title: Invalid column name on SQL Query
body: <p>I am currently teaching myself SQL on SQL Server and came across this practice problem but the solution keeps running an invalid column for my column alias</p>
  <p>QUESTION</p>
  <blockquote>
  <p>Select the name of each manufacturerer which having an average price above $145 and contain at least 2 different products.</p>
  </blockquote>
  <p>SOLUTION</p>
  <pre><code>SELECT M.name, AVG(P.price) AS avgprice, COUNT(p.manufacturer) AS mancount
  FROM manufacturers M, products P
  WHERE p.manufacturer = m.code
  GROUP BY p.manufacturer
  HAVING avgprice &gt;= 150 AND mancount &gt;= 2;
  </code></pre>