# Unions

Union one or multiple tables with the base table. Looks at all columns in each table and finds columns in common across all of them to keep in the final table.

## Parameters

| Name               | Type        | Description                                                                                                                                     | Is Optional |
| ------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| union\_tables      | table\_list | tables to union with the base table                                                                                                             |             |
| remove\_duplicates | boolean     | Defaults to False. Set to True to use UNION, which removes duplicate rows. Set to False to use UNION ALL, which keeps rows that are duplicated. | True        |

## Example

```python
d1 = rasgo.get.dataset(dataset_id)
d2 = rasgo.get.dataset(dataset_id_2)
d3 = rasgo.get.dataset(dataset_id_3)

union_ds = d1.unions(
    union_tables=[d2.fqtn, d3.fqtn]
    remove_duplicates=True
)

union_ds.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/unions/unions.sql>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/unions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
