> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Calculates a concatenated string from a group of strings, optionally separated by a delimiter, and optionally limited by a maximum number of elements.

# groupConcat

<h2 id="groupConcat">
  groupConcat
</h2>

Introduced in: v24.8.0

Calculates a concatenated string from a group of strings, optionally separated by a delimiter, and optionally limited by a maximum number of elements.

<Note>
  If delimiter is specified without limit, it must be the first parameter. If both delimiter and limit are specified, delimiter must precede limit.

  Also, if different delimiters are specified as parameters and arguments, the delimiter from arguments will be used only.
</Note>

**Syntax**

```sql theme={null}
groupConcat[(delimiter [, limit])](expression)
```

**Aliases**: `group_concat`

**Parameters**

* `delimiter` — A string that will be used to separate concatenated values. This parameter is optional and defaults to an empty string if not specified. [`String`](/reference/data-types/string)
* `limit` — A positive integer specifying the maximum number of elements to concatenate. If more elements are present, excess elements are ignored. This parameter is optional. [`UInt*`](/reference/data-types/int-uint)

**Arguments**

* `expression` — The expression or column name that outputs strings to be concatenated. [`String`](/reference/data-types/string)
* `delimiter` — A string that will be used to separate concatenated values. This parameter is optional and defaults to an empty string or delimiter from parameters if not specified. [`String`](/reference/data-types/string)

**Returned value**

Returns a string consisting of the concatenated values of the column or expression. If the group has no elements or only null elements, and the function does not specify a handling for only null values, the result is a nullable string with a null value. [`String`](/reference/data-types/string)

**Examples**

**Basic usage without a delimiter**

```sql title=Query theme={null}
SELECT groupConcat(Name) FROM Employees;
```

```response title=Response theme={null}
JohnJaneBob
```

**Using comma as a delimiter (parameter syntax)**

```sql title=Query theme={null}
SELECT groupConcat(', ')(Name) FROM Employees;
```

```response title=Response theme={null}
John, Jane, Bob
```

**Using comma as a delimiter (argument syntax)**

```sql title=Query theme={null}
SELECT groupConcat(Name, ', ') FROM Employees;
```

```response title=Response theme={null}
John, Jane, Bob
```

**Limiting the number of concatenated elements**

```sql title=Query theme={null}
SELECT groupConcat(', ', 2)(Name) FROM Employees;
```

```response title=Response theme={null}
John, Jane
```
