Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Fcommands-reference%2Funion.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Fcommands-reference%2Funion.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `union`

## Description

The `union` command concatenates the results from two or more datasets into one dataset. This allows users to combine results from multiple queries into one seamless dataset. One dataset can be a result set piped into the `union` command and then concatenated with another dataset.

## Syntax

```
<query> | union (<query>)
```

## Example

Combine logs from two different teams into a single dataset to analyze them together.

### Example data

```
// Logs for Team 58942

{ "id": "111", "name": "John" , "team.id": "58942" }

{ "id": "222", "name": "Emily", "team.id": "58942" }

{ "id": "333", "name": "Alice", "team.id": "58942" }



// Logs for Team 98361

{ "userid": "111", "timestamp": "2022-01-01T12:00:00Z", "team.id": "98361" }

{ "userid": "111", "timestamp": "2022-01-01T12:30:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }
```

### Example query

```
source logs(teamId='58942')

| union (source logs(teamId='98361'))
```

### Example output

```
{ "id": "111", "name": "John" , "team.id": "58942" }

{ "id": "222", "name": "Emily", "team.id": "58942" }

{ "id": "333", "name": "Alice", "team.id": "58942" }

{ "userid": "111", "timestamp": "2022-01-01T12:00:00Z", "team.id": "98361" }

{ "userid": "111", "timestamp": "2022-01-01T12:30:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }

{ "userid": "222", "timestamp": "2022-01-01T13:00:00Z", "team.id": "98361" }
```
