---
title: Table Join
description: Join two activity output tables using a configured join type and join conditions.
category: Data Transformation
tags: [join, table, data transformation, duckdb]
---

# Table Join

## **Description**

The **Table Join** activity joins two previous activity output tables using DuckDB. It reads the selected left and right activity tables, applies the configured join type and conditions, and writes the joined result as transformed data.

### **Supported Features**

- **Two-table joins**: Join a left activity table with a right activity table.
- **Multiple join types**: Supports join type values supplied by the table join editor, including inner, left, right, full outer, and cross join forms.
- **Multiple conditions**: Combines join conditions with `AND`.
- **Column-to-column conditions**: Compare a left table column to a right table column.
- **Column-to-value conditions**: Compare a left table column to a literal value when `Selected` is enabled.
- **Text operators**: Supports operators such as `contains`, `icontains`, `startswith`, `endswith`, `like`, `ilike`, `notlike`, `notilike`, and `rlike`.
- **Cross join support**: For `CROSS JOIN`, no `ON` clause is generated.

---

## **Input**

| Type | Required | Description |
| --- | --- | --- |
| Data | Yes | Data tables produced by previous activities. The configured `LeftTable` and `RightTable` identify which previous activity outputs are joined. |

### **Input Scenarios**

#### **1. Column-To-Column Join**

Left table:

| CustomerId | Name |
| --- | --- |
| 1 | Alice |
| 2 | Bob |

Right table:

| CustomerId | OrderId | Amount |
| --- | --- | --- |
| 1 | O-001 | 120 |
| 2 | O-002 | 90 |

#### **2. Column-To-Value Join**

Use when filtering the left table during the join condition, for example `Status = Active`.

#### **3. Cross Join**

Use when every row from the left table should be paired with every row from the right table. Conditions are ignored.

---

## **Output**

| Field | Type | Description |
| --- | --- | --- |
| Data | Array | Joined rows containing columns from both left and right tables. |

### **Example Output**

```json
{
  "Data": [
    {
      "CustomerId": 1,
      "Name": "Alice",
      "OrderId": "O-001",
      "Amount": 120
    },
    {
      "CustomerId": 2,
      "Name": "Bob",
      "OrderId": "O-002",
      "Amount": 90
    }
  ]
}
```

---

## **Configuration Fields**

| Field Name | Type | Required | Description |
| --- | --- | --- | --- |
| JoinValues | Table Join Editor | Yes | Join configuration containing the selected left table, right table, join type, and join conditions. |
| LeftTable | Activity Table | Yes | Previous activity output used as the left side of the join. |
| RightTable | Activity Table | Yes | Previous activity output used as the right side of the join. |
| JoinType | Dropdown | Yes | SQL join type inserted between the left and right tables. `CROSS JOIN` is treated specially and does not use conditions. |
| JoinConditions | Object Array | Conditional | Conditions used in the join `ON` clause. Required for non-cross joins. Multiple conditions are joined using `AND`. |
| LeftColumn | Column | Yes | Column from the left table used in the condition. |
| Operator | Text/Dropdown | Yes | Comparison operator. Standard SQL operators and supported text operators can be used. |
| RightColumn | Column or Value | Yes | Right table column when `Selected` is `false`; literal comparison value when `Selected` is `true`. |
| Selected | Boolean | No | When `false`, builds a column-to-column condition. When `true`, builds a column-to-value condition using `RightColumn` as a literal value. |

### **Conditional Field Rendering Rules**

The rendering behavior is controlled by the table join editor. In execution:

- **JoinConditions** are not used when **JoinType** is `CROSS JOIN`.
- **RightColumn** is treated as a literal value when **Selected** is `true`.
- **RightColumn** is treated as a right-table column when **Selected** is `false`.

---

## **Sample Configurations**

### **Scenario 1: Inner Join On CustomerId**

```json
{
  "JoinValues": {
    "leftTable": "Customers",
    "rightTable": "Orders",
    "joinType": "INNER JOIN",
    "joinConditions": [
      {
        "LeftColumn": "CustomerId",
        "Operator": "=",
        "RightColumn": "CustomerId",
        "Selected": false
      }
    ]
  }
}
```

### **Scenario 2: Join With Literal Value**

```json
{
  "JoinValues": {
    "leftTable": "Customers",
    "rightTable": "Orders",
    "joinType": "INNER JOIN",
    "joinConditions": [
      {
        "LeftColumn": "Status",
        "Operator": "=",
        "RightColumn": "Active",
        "Selected": true
      }
    ]
  }
}
```

---

## **Sample Output**

```json
{
  "Data": [
    {
      "CustomerId": 1,
      "Name": "Alice",
      "Status": "Active",
      "OrderId": "O-001",
      "Amount": 120
    }
  ]
}
```
