> For the complete documentation index, see [llms.txt](https://docs.coupler.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coupler.io/functionality/data-set/combining-data/join-data.md).

# Join data

Coupler.io allows you to fetch data from several sources at the same time, and join them into a unified dataset - all with a single importer.

Data **JOIN** is a term Coupler.io uses to describe the process of combining two or more sources using LEFT JOIN (from SQL terminology) - meaning, all the elements from the left set are kept while only matching elements from the right set are included

{% embed url="<https://www.youtube.com/watch?v=ZOi7mzr0e3c>" %}

### How to join data from multiple sources? <a href="#how-to-join-data-from-multiple-sources-7yscp" id="how-to-join-data-from-multiple-sources-7yscp"></a>

Let's take this example to understand this feature further. We have these source tables:&#x20;

{% columns %}
{% column width="58.333333333333336%" %}
*Source 1: Contacts*

<figure><img src="/files/8pmgOjjrgcuR5ZfMih3B" alt="" width="563"><figcaption><p><em>Contacts</em></p></figcaption></figure>
{% endcolumn %}

{% column width="41.666666666666664%" %}
*Source 2: Department*

<figure><img src="/files/HpzgdQHAiBzSeIwdIeDG" alt="" width="369"><figcaption><p><em>Department</em></p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

**Goal**: We want to get a list of "Contacts" under the "Partner sales" department. Currently, the "Contacts" table only has the IDs.

{% @arcade/embed flowId="l8nSlkOARJd5A6WlsqIz" url="<https://app.arcade.software/share/l8nSlkOARJd5A6WlsqIz>" %}

{% stepper %}
{% step %}
After adding the needed sources, go to the "Transformations" step and either select Join data from the data preview window, or hit + Add transformation >> Create Join option from the left sidebar
{% endstep %}

{% step %}
Select the sources to join and the columns that will be used as the key:
{% endstep %}

{% step %}
Click the "Join data" button and we will get the following results:
{% endstep %}

{% step %}
After joining the data, you can apply [other transformations](/functionality/data-set/preview-data-and-data-sets.md) such as: hide and reorder columns, filter and sort data, add a formula column, etc. to achieve the desired result:
{% endstep %}
{% endstepper %}

#### 1. Order of key source matters <a href="#key-order" id="key-order"></a>

Let's review 2 sources

{% columns %}
{% column width="58.333333333333336%" %}
*Source 1: Users data*

<figure><img src="/files/GDyli5d1ZbYpyX5kNXre" alt="" width="375"><figcaption><p>Users data</p></figcaption></figure>
{% endcolumn %}

{% column width="41.666666666666664%" %}
*Source 2: Additional user data*

<figure><img src="/files/29F3R4tP5y2J24Y8Ptqm" alt=""><figcaption><p>Additional user data</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

As we can see, both of the tables contain "Id" column representing the user id. But, together with that, amount of rows is different: 10 and 3 respectively

* In case "Users data" is chosen as the Key source, we will receive the next result (10 rows as in the key source):

<figure><img src="/files/uDhiQm1WKqT6rAvH1zJQ" alt=""><figcaption></figcaption></figure>

* In case "Additional user data" is chosen as the Key source, we will receive the next result (3 rows as in the key source):

<figure><img src="/files/n93ZG0s4yyHKQeIUSK71" alt=""><figcaption></figcaption></figure>

#### 2. Join by multiple fields <a href="#join-by-multiple-fields" id="join-by-multiple-fields"></a>

Along with Join by 2 sources, it is possible to join these sources by multiple fields

{% columns %}
{% column width="58.333333333333336%" %}
*Source 1: Users data*

<figure><img src="/files/A7q4U35nA9icot1bE4S0" alt=""><figcaption><p>Users data</p></figcaption></figure>
{% endcolumn %}

{% column width="41.666666666666664%" %}
*Source 2: Additional user data*

<figure><img src="/files/pgFdn1wf7cOLurf6BvcE" alt=""><figcaption><p>Additional user data</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

First, let's join these 2 sources by the "Id" field. The result will look like this (part of the data from "Additional user data" was cut due to missing references in the key source):

<figure><img src="/files/dxhv6ku6u8SiVlcKTgT7" alt=""><figcaption></figcaption></figure>

Next, we can join these 2 sources by one more column "Name".&#x20;

<div align="left"><figure><img src="/files/gY6jNnOvoWXH0PKkFPg6" alt="" width="375"><figcaption></figcaption></figure></div>

The result of both joins will look like this (first column changed):

<figure><img src="/files/6BIiYA6KbXFLpcnNatGd" alt=""><figcaption></figcaption></figure>

As a next step, we can clean up (filter out) results a bit and leave only rows that contain data. Also, we can hide some columns to have no duplicates.

<div align="left"><figure><img src="/files/SMZ3A8Py3E9fsfXJkL95" alt="" width="375"><figcaption></figcaption></figure></div>

And receive beautified results:

<figure><img src="/files/Y50MrCsj40IA2uHfOGaW" alt=""><figcaption></figcaption></figure>

#### 3. Join by multiple sources <a href="#join-by-multiple-sources" id="join-by-multiple-sources"></a>

**Goal:** We wanted to get a list of user names from the "Users" table, the amount of sold products from the "Transaction data" table, and product categories from the "Product data" table.

{% columns %}
{% column %}
*Source 1: Users data*

<figure><img src="/files/c90bYV7ulzSKCg3FfymY" alt=""><figcaption><p>Users Data</p></figcaption></figure>
{% endcolumn %}

{% column %}
*Source 2: Transaction data*

<figure><img src="/files/P3C0NusqtTiCvCbsI13Q" alt=""><figcaption><p><em>Transaction data</em></p></figcaption></figure>
{% endcolumn %}

{% column %}
*Source 3: Product data*

<figure><img src="/files/pwp2gfGU7cWtlx309Y7O" alt=""><figcaption><p><em>Product data</em></p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

Next data join setup will produce the desired result:

<div align="left"><figure><img src="/files/SDPIUM0a2VBExb8gTTQs" alt="" width="375"><figcaption></figcaption></figure></div>

After applying data join along with the current transformation capabilities, the goal was achieved:

<div align="left"><figure><img src="/files/oV8oM5RkjFM5m1PITNV8" alt="" width="375"><figcaption></figcaption></figure></div>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.coupler.io/functionality/data-set/combining-data/join-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
