# GREATEST

The GREATEST function returns the maximum value from multiple columns. When used with string fields, it returns the last string in alphabetical order. For boolean columns, it returns `true` if any value is `true`.

## Syntax

`GREATEST(first, rest)`

### Parameters

#### first

The first column to evaluate.

#### rest

The remaining columns to evaluate.

## Examples

Finds the maximum value between columns `a` and `b` and stores it in column `g`.
```esql
ROW a = 10, b = 20
| EVAL g = GREATEST(a, b)
```