Skip to main content

MAX (SQL)

A window function that assigns the maximum value of the field column within the specified window frame to all rows in that window frame.

Synopsis

MAX(field)

Description

MAX assigns the maximum value specified by the field column to all rows within the window frame. MAX supports the ROWS clause.

Arguments

field

A column that specifies from where to take the maximum value.

Examples

The following example compares each employee's salary against the highest salary earned by an employee within that employee's department:

SELECT MAX(Salary) OVER (PARTITION BY Department) FROM Company.Employee

See Also

FeedbackOpens in a new tab