HAVING Clause

Performs a filter operation on a SELECT query, by examining the results of aggregation functions rather than testing each individual table row. Therefore, it is always used in conjunction with a function such as [COUNT()]($97f557dcc36c3360.md#count), [SUM()]($a792f4705aba18b3.md#sum), [AVG()]($95f4b67845ae13ef.md#avg), [MIN()]($73c276df07d34aa5.md#min), or [MAX()]($c867272f30ed4796.md#max), and typically with the [GROUP BY]($dfb59a026297e631.md#group_by) clause also.

Restrictions:

The filter expression in the HAVING clause cannot include a scalar subquery.

Related information:

SELECT Statement, GROUP BY Clause, Impala Aggregate Functions

Parent topic: SELECT Statement