mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
25 lines
386 B
Markdown
25 lines
386 B
Markdown
---
|
|
toc_priority: 3
|
|
---
|
|
|
|
# max {#agg_function-max}
|
|
|
|
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;
|
|
```
|
|
|