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

> Creates an array from different argument values.

# groupUniqArray

<h2 id="groupUniqArray">
  groupUniqArray
</h2>

Introduced in: v1.1.0

Creates an array from different argument values.
The memory consumption of this function is the same as for the [`uniqExact`](/reference/functions/aggregate-functions/uniqExact) function.

**Syntax**

```sql theme={null}
groupUniqArray(x)
groupUniqArray(max_size)(x)
```

**Parameters**

* `max_size` — Limits the size of the resulting array to `max_size` elements. `groupUniqArray(1)(x)` is equivalent to `[any(x)]`. [`UInt64`](/reference/data-types/int-uint)

**Arguments**

* `x` — Expression. [`Any`](/reference/data-types/index)

**Returned value**

Returns an array of unique values. [`Array`](/reference/data-types/array)

**Examples**

**Usage example**

```sql title=Query theme={null}
CREATE TABLE t (x UInt8) ENGINE = Memory;
INSERT INTO t VALUES (1), (2), (1), (3), (2), (4);

SELECT groupUniqArray(x) FROM t;
```

```response title=Response theme={null}
┌─groupUniqArray(x)─┐
│ [1,2,3,4]         │
└───────────────────┘
```

**With max\_size parameter**

```sql title=Query theme={null}
SELECT groupUniqArray(2)(x) FROM t;
```

```response title=Response theme={null}
┌─groupUniqArray(2)(x)─┐
│ [1,2]                │
└──────────────────────┘
```
