SQLite GROUP_CONCAT() Function
Example
Join all the shipper names into one text:
SELECT GROUP_CONCAT(ShipperName)
FROM Shippers;
Try it Yourself »
Definition and Usage
The GROUP_CONCAT() function joins all the values in a group into one text. NULL values are skipped. The default separator is a comma.
Tip: Also look at STRING_AGG().
Syntax
GROUP_CONCAT(expression, separator)
Parameter Values
| Parameter | Description |
|---|---|
| expression | Required. A column or a calculation |
| separator | Optional. The text to put between the values. Default is a comma |
Technical Details
| Return type: | Text |
|---|
More Examples
Example
List the cities in each country:
SELECT Country, GROUP_CONCAT(City, '; ')
FROM Customers
GROUP BY Country;
Try it Yourself »