Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

MAX

Syntax

MAX ( { [ALL] expression } | { DISTINCT column_ref } )

Description

The aggregate function MAX returns the maximum value in a group of values.

  • The specification of DISTINCT has no effect on the result.
  • The result of the function is of the same data type as that of the argument.
  • The argument column_ref or expression can be of any type.
  • The result is null if the result set is empty or contains only null values.

Example

SELECT order_date, product, MAX (qty)

FROM orders

GROUP BY order_date, product ;

TOCIndex