> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ARRAY_JOIN

> Joins array elements as text.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`array_to_string`](/query/sql/functions/array/array_to_string)

NULL array/delimiter return NULL. NULL elements are skipped unless non-NULL null\_text is supplied.

## Syntax

### With null text (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
array_join(array, delimiter, null_text)
```

* The optional third argument is available only with ARRAY\_JOIN.

### Array join default (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
array_join(array, delimiter)
```

## Arguments

Type notation used below:

* T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP or ARRAY.

### With null text

| Name | Type | Required | Description |
| - | - | - | - |
| array | ARRAY\<T> | Yes | Elements. Nested elements/fields must satisfy the same element-type restrictions. |
| delimiter | STRING | Yes | Separator. |
| null\_text | STRING | Yes | Text for NULL elements. |

### Array join default

| Name | Type | Required | Description |
| - | - | - | - |
| array | ARRAY\<T> | Yes | Elements. Nested elements/fields must satisfy the same element-type restrictions. |
| delimiter | STRING | Yes | Separator. |

## Returns

* Type: STRING
* Possible values: Joined text.
* NULL behavior: NULL array/delimiter return NULL. NULL elements are skipped unless non-NULL null\_text is supplied.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* Nested arrays are traversed recursively.
* NULL replacement text behaves like an omitted replacement and skips NULL elements. Nested list elements are recursively joined in encounter order. Leaf types include strings, booleans, integers, FLOAT/DOUBLE and types convertible to STRING; other leaf types raise an error.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Alias calling form: ARRAY\_JOIN

Join the values with a comma between them.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_join(ARRAY[1, 2, 3], ',') AS result;
```

| result |
| - |
| 1,2,3 |

When the array contains NULL, omit those elements or supply replacement text:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_join(ARRAY[1, NULL, 2], ',') AS skipped, array_join(ARRAY[1, NULL, 2], ',', 'X') AS substituted;
```

| skipped | substituted |
| - | - |
| 1,2 | 1,X,2 |

## Limitations

* Pass an ARRAY as the first argument. Reported VARCHAR widths do not limit or truncate the returned text.
* MAP and STRUCT elements are not supported.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.