MAX() OVER ...
All functions > WINDOW FUNCTION > MAX() OVER ...
Returns the maximum value in the window frame.
Syntax
MAX(expr) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- Finds maximum value over a window of rows
- Useful for running maximums and comparisons
- Returns same type as input expression
- NULL values are ignored in the calculation
See also
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY[30,10,20] AS v).TRANSFORM(SELECT MAX(v) OVER (ORDER BY id ASC)).UNWRAP() -- Running maximum (v permuted so output is not the same array as v)
;Result
| f1 ARRAY |
|---|
| [30, 30, 30] |