GROUP_CONCAT
Returns a string which is the concatenation of all non NULL values of an input column or grouping.
The order of the concatenated elements is arbitrary.
See also:
[SELECT]
Syntax
SELECT GROUP_CONCAT(columnExpression [, separator]) FROM <multipartIdentifier>
[ GROUP BY groupByColumn ];
Arguments
columnExpression
A column or expression.
At least one value from the columnExpression must be non
NULLotherwiseNULLis returned.
separator
Separator used for the concatenated result, the default of , is used if separator is not specified.
groupByColumn
A column or columns used to perform summary or aggregate operations against. The GROUP BY clause returns one row for each column grouping.
Return Value(s)
Returns a string as a list of values separated by the separator or ,.
Examples
Return a list of values for a column over an entire resource
SELECT group_concat(name) as instance_list
FROM google.compute.instances
WHERE project = 'stackql-demo'
AND zone = 'australia-southeast1-a';
Return a list of values for a column expression grouped by another column expression
SELECT tags, group_concat(name) as instance_list
FROM google.compute.instances
WHERE project = 'stackql-demo'
AND zone = 'australia-southeast1-a'
GROUP BY json_extract(tags, '$.instanceType');
For more information, see https://www.sqlite.org/lang_aggfunc.html#group_concat.