STRING_AGG() OVER ...
All functions > WINDOW FUNCTION > STRING_AGG() OVER ...
Concatenates string values in the window frame in order up to the current row, separated by the delimiter.
Syntax
STRING_AGG(expr, delimiter) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- SQL translation is implemented only when the current SQL backend is DuckDB
- Requires a well-defined window (ORDER BY, and optionally PARTITION BY and frame)
- NULL values are ignored where the underlying window aggregate skips NULLs
See also
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY['a', 'b', 'c'] AS s).TRANSFORM(SELECT STRING_AGG(s, '|') OVER (ORDER BY id ASC)).UNWRAP() -- Running string concatenation with a delimiter that avoids commas inside elements
;Result
| f1 ARRAY |
|---|
| [a, a|b, a|b|c] |