MAX() GROUP BY ...
All functions > GROUP BY > MAX() GROUP BY ...
Returns the maximum value in the group.
Syntax
Diagram(
Sequence(
Terminal("MAX"),
Terminal("("),
NonTerminal("expr"),
Terminal(")"),
Choice(0, Skip(),
Sequence(
Terminal("FILTER"),
Terminal("("),
Terminal("WHERE"),
NonTerminal("condition"),
Terminal(")")
)
),
Choice(0, Skip(),
Sequence(
Terminal("GROUP BY"),
OneOrMore(NonTerminal("feature"), Terminal(","))
)
)
)
)| Parameter | Type | Required | Description |
|---|---|---|---|
expr | T | Yes | The expression to find the maximum value of |
condition | BOOLEAN | No | The condition to filter the values before aggregation |
feature | FEATURE | No | The features to group by (many features are supported) |
Notes
- Returns the largest value in the group
- Works with numeric, string, and date types
- NULL values are excluded from the calculation
- Returns NULL if all values are NULL or group is empty
- With num_values parameter, returns an array of the N largest values
- Can be used with WHERE clause to filter before aggregation
- Can be used with GROUP BY clause for grouped aggregation