19 lines
570 B
Plaintext
19 lines
570 B
Plaintext
|
[[esql-greatest]]
|
||
|
=== `GREATEST`
|
||
|
|
||
|
Returns the maximum value from many columns. This is similar to <<esql-mv_max>>
|
||
|
except it's intended to run on multiple columns at once.
|
||
|
|
||
|
[source.merge.styled,esql]
|
||
|
----
|
||
|
include::{esql-specs}/math.csv-spec[tag=greatest]
|
||
|
----
|
||
|
[%header.monospaced.styled,format=dsv,separator=|]
|
||
|
|===
|
||
|
include::{esql-specs}/math.csv-spec[tag=greatest-result]
|
||
|
|===
|
||
|
|
||
|
NOTE: When run on `keyword` or `text` fields, this'll return the last string
|
||
|
in alphabetical order. When run on `boolean` columns this will return
|
||
|
`true` if any values are `true`.
|