webCOMAND

GROUP_CONCAT()

Concatenate grouped rows/objects together in a comma (or custom) separated string.

Prototype

string GROUP_CONCAT([DISTINCT] expression [ORDER BY expression] [SEPARATOR ','])

Parameters

  • DISTINCT - If specified, only unique expression results will be concatenated.  Duplicates will be ignored.
  • expression - Expression to concatenate for all aggregated rows.
  • ORDER BY expression - Optional ORDER BY clause to apply to the grouped values.
  • SEPARATOR - Optional string to separate each non-NULL concatenated expression result.  If not specified, the default is a comma.  Text string escape sequences will be interpreted.

Return

Concatenated expression for all aggregated non-NULL expression results.

Example

SELECT OID, Date, GROUP_CONCAT(LineItems.Description SEPARATOR '\n') AS TotalAmount FROM Invoice