GROUP_CONCAT

GROUP_CONCAT([DISTINCT] expression || [expression || [expression ...]]
  [ORDER BY expression [ASC|DESC], [[ORDER BY expression [ASC|DESC]]] 
  [SEPARATOR expression])

The expression can be a concatenation of columns and strings using the || operator, for example column1 || "=" || column2.

Parameters

  • DISTINCT - filters the result set for unique sets of expressions.
  • expression - specifies an expression that may be a column name, a result of another function, or a math operation.
  • ORDER BY - orders rows by expression.
  • SEPARATOR - overrides a string separator. By default, the separator character is the comma ','.

❗️

The DISTINCT and ORDER BY expressions inside the GROUP_CONCAT function are only supported if you group the results by the primary or affinity key (i.e. use GROUP BY). Moreover, you have to tell Ignite that your data is collocated by specifying the collocated=true property in the connection string or by calling SqlFieldsQuery.setCollocated(true) if you use the Java API.

Description

Concatenates strings with a separator. The default separator is a ',' (without space). This method returns a string. If no entries are selected, the result is NULL. Aggregates are only allowed in select statements.

Example

Groups all players' names in one row:

SELECT GROUP_CONCAT(name ORDER BY id SEPARATOR ', ') FROM Players;