<p>Hi why doesn't this work in SQL Server 2005?</p>

<pre><code>select HALID, count(HALID) as CH from Outages.FaultsInOutages

where CH &gt; 3

group by HALID
</code></pre>

<p>I get invalid column name 'CH'</p>

<hr>

<p>i think having was the right way to go but still receive the error:
Invalid column name 'CH'.</p>

<p>When running:</p>

<p>select HALID, count(HALID) as CH from Outages.FaultsInOutages 
group by HALID having CH > 3</p>

Try
```
```
select HALID, count(HALID) from Outages.FaultsInOutages 
group by HALID having count(HALID) > 3
```
```
Your query has two errors:
Using where an aggregate when grouping by, solved by using having
Using an alias for an aggregate in the condition, not supported, solved by using the aggregate again