greatest.asciidoc 864 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. *Supported types*
  19. include::types/greatest.asciidoc[]
  20. *Example*
  21. [source.merge.styled,esql]
  22. ----
  23. include::{esql-specs}/math.csv-spec[tag=greatest]
  24. ----
  25. [%header.monospaced.styled,format=dsv,separator=|]
  26. |===
  27. include::{esql-specs}/math.csv-spec[tag=greatest-result]
  28. |===