Joins
A join connects records from two JSON sources.
Bare
join keeps both sidesUse inner join, left join, or right join when you want that specific behavior. A bare join is a full outer join and keeps unmatched rows from both sources.
select {orderId: o.id, customer: c.name}
from 'orders.json' as o
inner join 'customers.json' as c on o.customerId = c.id
The on condition says how the records are related. Aliases such as o and c keep the fields easy to identify.
Join types
| Syntax | Rows kept |
|---|---|
inner join | Matching combinations only. |
left join | Matches and unmatched rows from the left source. |
right join | Matches and unmatched rows from the right source. |
join | Matches and unmatched rows from both sources. |
For an unmatched aliased source, the alias has a null value. Its projected fields are left out of the result.
One-to-many matches
JQL checks every left record against every right record. If one customer has several matching orders, every matching pair becomes a result row.
Multiple joins
Write joins in dependency order. A later join can use an alias introduced earlier:
from 'orders.json' as o
inner join 'customers.json' as c on o.customerId = c.id
inner join 'regions.json' as r on c.regionId = r.id
Joined sources may also use nested source paths. where runs after all joins are complete.