max

Aggregate Function

max — maximum value of input values

Synopsis

max(number|string) -> number|string

Description

The max aggregate function computes the maximum value of its input.

When determining the max of string inputs, values are compared via byte order. This is equivalent to C/POSIX collation as found in other SQL databases such as Postgres.

Examples

Maximum value of simple numeric sequence:

max(this)
1
2
3
4
Loading...

Continuous maximum of simple numeric sequence:

yield max(this)
1
2
3
4
Loading...

Maximum of several string values:

max(this)
"bar"
"foo"
"baz"
Loading...

A mix of string and numeric input values results in an error:

max(this)
1
"foo"
2
Loading...

Other unrecognized types in mixed input are ignored:

max(this)
1
2
3
4
127.0.0.1
Loading...

Maximum value within buckets grouped by key:

max(a) by k | sort
{a:1,k:1}
{a:2,k:1}
{a:3,k:2}
{a:4,k:2}
Loading...

SuperDB