greatest.asciidoc 717 B

12345678910111213141516171819202122232425
  1. [discrete]
  2. [[esql-greatest]]
  3. === `GREATEST`
  4. [.text-center]
  5. image::esql/functions/signature/greatest.svg[Embedded,opts=inline]
  6. Returns the maximum value from many columns. This is similar to <<esql-mv_max>>
  7. except it's intended to run on multiple columns at once.
  8. [source.merge.styled,esql]
  9. ----
  10. include::{esql-specs}/math.csv-spec[tag=greatest]
  11. ----
  12. [%header.monospaced.styled,format=dsv,separator=|]
  13. |===
  14. include::{esql-specs}/math.csv-spec[tag=greatest-result]
  15. |===
  16. NOTE: When run on `keyword` or `text` fields, this'll return the last string
  17. in alphabetical order. When run on `boolean` columns this will return
  18. `true` if any values are `true`.
  19. Supported types:
  20. include::types/greatest.asciidoc[]