Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Queries and data modification » Summarizing, grouping, and sorting query results

 

The HAVING clause: Selecting groups of data

The HAVING clause restricts the rows returned by a query. It sets conditions for the GROUP BY clause similar to the way in which WHERE sets conditions for the SELECT clause.

The HAVING clause search conditions are identical to WHERE search conditions except that WHERE search conditions cannot include aggregates. For example, the following usage is allowed:

HAVING AVG( UnitPrice ) > 20

The following usage is not allowed:

WHERE AVG( UnitPrice ) > 20
 Using HAVING with aggregate functions
 Using HAVING without aggregate functions
 More than one condition in HAVING
 See also