ClickHouse/docs/en/sql-reference/aggregate-functions/reference/max.md

25 lines
370 B
Markdown
Raw Normal View History

---
sidebar_position: 3
---
2022-06-02 10:55:18 +00:00
# max
2021-04-28 01:37:44 +00:00
Aggregate function that calculates the maximum across a group of values.
Example:
```
SELECT max(salary) FROM employees;
```
```
SELECT department, max(salary) FROM employees GROUP BY department;
```
If you need non-aggregate function to choose a maximum of two values, see `greatest`:
```
SELECT greatest(a, b) FROM table;
```