v.24.7New Feature

Add groupConcat Aggregate Function with Custom Delimiter and Element Limit

Add aggregate function groupConcat. About the same as arrayStringConcat( groupArray(column), ',') Can receive 2 parameters: a string delimiter and the number of elements to be processed. #65451 (Yarik Briukhovetskyi).
Added the aggregate function <code>groupConcat</code>, which concatenates grouped string values similarly to <code>arrayStringConcat(groupArray(column), ',')</code>.

Why it matters

Provides a convenient and efficient way to concatenate string values from grouped rows with a specified delimiter. It solves the problem of manually combining strings after aggregation, improving query expressiveness and performance.

How to use it

Use <code>groupConcat</code> as an aggregate function with up to two parameters: the delimiter string and an optional limit on the number of concatenated elements. For example:

SELECT groupConcat(column, ', ', 100) FROM table GROUP BY some_key

This concatenates up to 100 values of column per group, separated by ', '.