Specifies the search condition for the group to meet. The search condition can use aggregate 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.
The following queries are allowed in SQL Server, but are not allowed in SQL Server Compact, and cause the following error message to appear: "In aggregate and grouping expressions, the HAVING clause can contain only aggregate functions and grouping expressions."