NULL string values from a group into a single string, with each value separated by the specified delimiter.
Syntax
Parameters
Return Type
TEXT
Remarks
NULLvalues in<expression>are silently skipped.- If all input values are
NULL, or if the input set is empty,STRING_AGGreturnsNULL. - No specific order for the concatenation of values is guaranteed. To concatenate in a specific order, use ARRAY_AGG, ARRAY_SORT, and ARRAY_TO_STRING.
- An empty
<delimiter>(empty string'') concatenates values without any separator.
Example
Thelevels table contains the following values:
Rows: 10Execution time: 5.13ms
leveltype, separated by commas:
Rows: 3Execution time: 10.18ms
NULL values are skipped:
Rows: 1Execution time: 3.82ms