Previous Topic Next topic Print topic


HAVING Clause

Commonly used in conjunction with the GROUP BY clause, the HAVING clause qualifies aggregate record group results that appear in the query output.

The optional HAVING clause is used to qualify groups of records within a query result, and requires the use of aggregate functions. HAVING can be used with or without a GROUP BY clause. If no GROUP BY clause is specified, the SELECT clause in the query statement may only list aggregate functions -- in which case the conditions specified in the HAVING clause are applied to each aggregate group value. Each item in the search-condition must compare one aggregate property of a group with a constant, expression, nested query result, or another aggregate property of the same group. Nested queries are permitted within a HAVING clause.

Syntax

The HAVING clause format appears below:

HAVING search-condition

where:

search-condition A set of one or more conditions that group values must satisfy in order to qualify for retrieval.
Previous Topic Next topic Print topic