leftsemi join

Learn how to use the leftsemi join flavor to merge the rows of two tables.

The leftsemi join flavor returns all records from the left side that match a record from the right side. Only columns from the left side are returned.

Diagram that shows how the join works.

Syntax

LeftTable | join kind=leftsemi [ Hints ] RightTable on Conditions

Returns

Schema: All columns from the left table.
Rows: All records from the left table that match records from the right table.

Example

This query filters and returns only those rows from table X that have a matching key in table Y.

let X = datatable(Key:string, Value1:long)
[
    'a',1,
    'b',2,
    'b',3,
    'c',4
];
let Y = datatable(Key:string, Value2:long)
[
    'b',10,
    'c',20,
    'c',30,
    'd',40
];
X | join kind=leftsemi Y on Key

Output

KeyValue1
b2
b3
c4