MAX()

Aggregate. Returns the maximum value of a given expression over multiple rows.

Syntax

MAX( expression )
Data Types

Return

expression

Integer

Integer

Long

Long

Float

Float

Interval

Interval

Timestamp

Timestamp

String

String

BLOB

BLOB

Usage

DISTINCT is permitted, but has no effect because the maximum of the distinct values is the same as the maximum of all values.

Example

The following example calculates the maximum value of the Price column over the last five minutes:

INSERT INTO OutStream
SELECT MAX(Trades.Price)
FROM Trades KEEP 5 MINUTES;