LISTAGG
Concatenates a group of rows into a list of strings and places a separator between them.
Syntax
LISTAGG ( [ALL | DISTINCT] measure_expr [, βdelimiterβ] ) [WITHIN GROUP ( ORDER BY measure_expr [ASC | DESC] )]
ALL: Keeps duplicate values in the return list. This is the default behavior.
DISTINCT: Removes duplicate values from the return list.
measure_expr: A string column or value.
delimiter: Designates a string literal to separate the measure column values. If a delimiter is not specified, will default to
NULL
.[WITHIN GROUP ( ORDER BY measure_expr [ASC | DESC] )]: Determines the order in which the concatenated values are returned. Using one of the optional keywords -
ASC
orDESC
- returns the values in ascending or descending order, respectively. The default order is ascending.
Examples
Usage Notes
If the return list is greater than 32768 bytes, then Spice truncates it.
Last updated