Lists & arrays
Aggregate
array_agg()
Returns a LIST containing all the values of a column.
Alias of list()
Arguments & returns
array_agg(arg)
Aggregate
| Overload link | arg |
Returns |
|---|---|---|
| #01 | T |
T[] |
Example
Haybarn WASM 1.5.5-rc3 · In your browser
Engine example with sample data · Run to view results.
In other engines
Apache Hivecollect_list()
COLLECT_LIST(x)
ARRAY_AGG(x) FILTER(WHERE x IS NOT NULL)
BigQueryarray_agg()
SELECT ARRAY_AGG(x IGNORE NULLS) AS x
SELECT ARRAY_AGG(x) FILTER(WHERE x IS NOT NULL) AS x
Snowflakearray_agg()
SELECT ARRAY_AGG(DISTINCT a)
SELECT ARRAY_AGG(DISTINCT a) FILTER(WHERE a IS NOT NULL)