# CONCAT_WS

> CONCAT_WS function in StackQL: join values into one string with a separator between them, skipping NULL values.

Source: https://stackql.io/language-spec/functions/string/concat_ws

Concatenates its arguments after the first into one string, with the first argument placed between them as a separator.  `NULL` values are skipped, along with their separator.

See also:  
[[` SELECT `]](/language-spec/select) [[` CONCAT `]](/language-spec/functions/string/concat) [[ Concatenation ]](/language-spec/functions/string/concatenation)

* * * 

## Syntax

```sql
SELECT CONCAT_WS(separator, value [, value ...]) FROM <multipartIdentifier>;
```

## Arguments

__*separator*__  
The string placed between consecutive values.

__*value*__  
One or more expressions.  Numbers are converted to text.

## Return Value(s)
Returns a string.  The result is `NULL` if *separator* is `NULL`.

* * *

## Examples

### Join values with a separator

The `NULL` value and its separator are left out:

```sql
SELECT CONCAT_WS('-', 'a', 'b', NULL, 'c') AS v;
```

```
|-------|
|   v   |
|-------|
| a-b-c |
|-------|
```

### Build a path from columns

The following query builds an `owner/repository/branch` path for each repository in a GitHub organization:

```sql
SELECT CONCAT_WS('/', 'stackql-labs', name, default_branch) AS repo_path
FROM github.repos.repos
WHERE org = 'stackql-labs';
```

For more information, see [https://www.sqlite.org/lang_corefunc.html#concat_ws](https://www.sqlite.org/lang_corefunc.html#concat_ws)
