mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
7170f3c534
* prefer relative links from root * wip * split aggregate function reference * split system tables
14 lines
708 B
Markdown
14 lines
708 B
Markdown
---
|
||
toc_title: HAVING
|
||
---
|
||
|
||
# HAVING Clause {#having-clause}
|
||
|
||
Allows filtering the aggregation results produced by [GROUP BY](../../../sql-reference/statements/select/group-by.md). It is similar to the [WHERE](../../../sql-reference/statements/select/where.md) clause, but the difference is that `WHERE` is performed before aggregation, while `HAVING` is performed after it.
|
||
|
||
It is possible to reference aggregation results from `SELECT` clause in `HAVING` clause by their alias. Alternatively, `HAVING` clause can filter on results of additional aggregates that are not returned in query results.
|
||
|
||
## Limitations {#limitations}
|
||
|
||
`HAVING` can’t be used if aggregation is not performed. Use `WHERE` instead.
|