MAX Function [Aggregate]

Returns the maximum expression value found in each group of rows.

Syntax

MAXexpression
| DISTINCT column-name )

Parameters

Parameter

Description

expression

The expression for which the maximum value is to be calculated. This is commonly a column name.

DISTINCT column-name

Returns the same as MAX ( expression ), and is included for completeness.

Returns

The same data type as the argument.

Example

The following statement returns the value 138948.000, representing the maximum salary in the Employees table:

SELECT MAX ( Salary )
FROM Employees

Usage

Rows where expression is NULL are ignored. Returns NULL for a group containing no rows.

Standards and Compatibility

  • SQL—ISO/ANSI SQL compliant.

  • Sybase—Compatible with Adaptive Server Enterprise.

Related concepts
Windowing Aggregate Function Usage
Related reference
MIN Function [Aggregate]