1
0

greatest.asciidoc 845 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. [discrete]
  2. [[esql-greatest]]
  3. === `GREATEST`
  4. *Syntax*
  5. [.text-center]
  6. image::esql/functions/signature/greatest.svg[Embedded,opts=inline]
  7. *Parameters*
  8. `first`::
  9. First of the columns to evaluate.
  10. `rest`::
  11. The rest of the columns to evaluate.
  12. *Description*
  13. Returns the maximum value from multiple columns. This is similar to <<esql-mv_max>>
  14. except it is intended to run on multiple columns at once.
  15. NOTE: When run on `keyword` or `text` fields, this returns the last string
  16. in alphabetical order. When run on `boolean` columns this will return
  17. `true` if any values are `true`.
  18. include::types/greatest.asciidoc[]
  19. *Example*
  20. [source.merge.styled,esql]
  21. ----
  22. include::{esql-specs}/math.csv-spec[tag=greatest]
  23. ----
  24. [%header.monospaced.styled,format=dsv,separator=|]
  25. |===
  26. include::{esql-specs}/math.csv-spec[tag=greatest-result]
  27. |===