JSON_ARRAY_AGG
Overview
Aggregates a set of values into a JSON array and returns a STRING. Supports DISTINCT deduplication and ORDER BY ordering.
Syntax
Parameters
<expr>: The column or expression to aggregate.DISTINCT: Deduplicate values before aggregating. The order of results is not guaranteed.WITHIN GROUP (ORDER BY ...): Specify the ordering of elements in the resulting array.
Examples
Related Documentation
- JSON_OBJECT_AGG — aggregates into a JSON object
- COLLECT_LIST — aggregates into an ARRAY type
- JSON_ARRAY_GET
