SQL Server 2000
Specifies a search condition for a group or an aggregate. HAVING is usually used with the GROUP BY clause.
[ HAVING < search_condition > ]
- < search_condition >
- Specifies the search condition for the group to meet. The search condition can use aggregate expressions and nonaggregate expressions. The only columns that can be used in the nonaggregate expressions are those specified as grouping columns in the GROUP BY clause. This is because the group-by columns represent common properties for the entire group. Likewise, the aggregate expressions represent a common property for the entire group. The HAVING clause search condition is expressing a predicate over the properties of the group.
The image and ntext data types cannot be used in a HAVING clause.