max.asciidoc 917 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [discrete]
  2. [[esql-agg-max]]
  3. === `MAX`
  4. *Syntax*
  5. [source,esql]
  6. ----
  7. MAX(expression)
  8. ----
  9. *Parameters*
  10. `expression`::
  11. Expression from which to return the maximum value.
  12. *Description*
  13. Returns the maximum value of a numeric expression.
  14. *Example*
  15. [source.merge.styled,esql]
  16. ----
  17. include::{esql-specs}/stats.csv-spec[tag=max]
  18. ----
  19. [%header.monospaced.styled,format=dsv,separator=|]
  20. |===
  21. include::{esql-specs}/stats.csv-spec[tag=max-result]
  22. |===
  23. The expression can use inline functions. For example, to calculate the maximum
  24. over an average of a multivalued column, use `MV_AVG` to first average the
  25. multiple values per row, and use the result with the `MAX` function:
  26. [source.merge.styled,esql]
  27. ----
  28. include::{esql-specs}/stats.csv-spec[tag=docsStatsMaxNestedExpression]
  29. ----
  30. [%header.monospaced.styled,format=dsv,separator=|]
  31. |===
  32. include::{esql-specs}/stats.csv-spec[tag=docsStatsMaxNestedExpression-result]
  33. |===