SQL Server 2008 R2
Specifies a search condition for a group or an aggregate. HAVING is usually used with the GROUP BY clause.
The following queries are allowed in SQL Server, but are not allowed in SQL Server Compact 3.5, and cause the following error message to appear: "In aggregate and grouping expressions, the HAVING clause can contain only aggregate functions and grouping expressions."
select count(*), c1+c2 from s1 group by c1+c2 having c1+c2 <10; select count(*), x from (select *, col1 + col2 as x from oj1) d group by x having x <4;
However, these queries are allowed in SQL Server Compact 3.5 if a simple column variable is used instead of an expression, such as (c1+c2).
