ClickHouse/docs/en/sql-reference/statements/select/having.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
729 B
Markdown
Raw Normal View History

---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/statements/select/having
sidebar_label: HAVING
---
2022-06-02 10:55:18 +00:00
# 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.
2022-06-02 10:55:18 +00:00
## Limitations
`HAVING` cant be used if aggregation is not performed. Use `WHERE` instead.