Join

join

Combines rows from two tables by matching values on a specified key column. Supports multiple join kinds.

Spec

<left_table>
| join kind=<join_kind> (<right_table>) on <key_column>

Parameters

join_kind    - The type of join (see below). Default is inner.
right_table  - The right-side table expression, enclosed in parentheses.
key_column   - The column name to match between left and right tables.

Join Kinds

KindDescription
inneruniqueInner join with left-side deduplication on the key (default).
innerRows that match in both tables.
leftouterAll left rows; matched right columns or null.
rightouterAll right rows; matched left columns or null.
fullouterAll rows from both tables; null where no match.
leftsemiLeft rows that have a match in the right table.
leftantiLeft rows that have no match in the right table.
rightsemiRight rows that have a match in the left table.
rightantiRight rows that have no match in the left table.
crossCartesian product of both tables (no on clause required).

Return Value

A table with columns from both sides, combined according to the join kind.

Example

Inner join

datatable(Id:int64, Name:string)[1, "Alice", 2, "Bob", 3, "Carol"]
| join kind=inner (
    datatable(Id:int64, Score:int64)[1, 85, 2, 92, 4, 70]
) on Id
IdNameScore
1Alice85
2Bob92

Left anti join

datatable(Id:int64, Name:string)[1, "Alice", 2, "Bob", 3, "Carol"]
| join kind=leftanti (
    datatable(Id:int64, Score:int64)[1, 85, 2, 92]
) on Id
IdName
3Carol