ARRAY_AGG
Overview
Aggregates a set of values into an ARRAY. Supports DISTINCT deduplication and WITHIN GROUP ORDER BY ordering. Functionally identical to COLLECT_LIST; ARRAY_AGG is the SQL-standard spelling.
Syntax
Parameters
<expr>: The column or expression to aggregate.DISTINCT: Deduplicate values before aggregating.WITHIN GROUP (ORDER BY ...): Specify the ordering of elements in the resulting array.
Examples
Related Documentation
- COLLECT_LIST — alias function with identical behavior
- JSON_ARRAY_AGG — aggregates into a JSON array string
