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()]($38203069b9301e6b.md#count), [SUM()]($79326ebbfad28a19.md#sum), [AVG()]($9e608d6dbc85e4fe.md#avg), [MIN()]($72a839014b6964af.md#min), or [MAX()]($5188c27db7c618b9.md#max), and typically with the [GROUP BY]($a7355b6eff3af334.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