Shape · Combine tables

Join

Matches rows from two tables on one or more key columns: inner, left, right, full, anti or semi. Keys can also compare with <, > or between, for range joins.

Also known as: Merge, merge queries

How it works

Wire the two tables into left and right, choose a Join type and click Add key under Match keys for each condition: a left key, an operator (=, <, ≤, >, ≥ or between, which takes a lower and an upper right column) and a right key. Inner, Left, Right and Full keep columns from both sides; when every key is an = on the same name, that column appears once. Left anti keeps left rows with no match, Right anti right rows with no match, Semi left rows with a match, each with that side's columns only. Match empty keys lets null match null on an = key; otherwise null never matches. Right-column prefix keeps every column of both sides and prefixes a right column whose name the left also has; Drop columns and Rename columns then apply to the output, and a name that finds nothing is skipped.

Inputs and outputs

Inputs

  • left — Table
  • right — Table

Outputs

  • data — Table

Settings

The Attributes panel of Join, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
{
  joinType: "inner"|"left"|"right"|"outer"|"anti"|"rightAnti"|"semi"
  keys: [{ leftKey, op: "="|"<"|"<="|">"|">="|"between", rightKey, rightHigh? }]
  nullsMatch?: boolean
  rightPrefix?: string
  dropColumns?: string[]
  renameColumns?: [{ from, to }]
}

anti/semi keep left columns, rightAnti keeps right columns; non-"=" ops range-join; "between" matches rightKey..rightHigh (inclusive). nullsMatch lets an "=" key match NULL to NULL. rightPrefix keeps both sides' columns (keys too) and prefixes a right column whose name the left has; dropColumns / renameColumns then apply to the output by name (or, with rightPrefix, Left_<name> / Right_<name> for a side's own column), skipping names that find nothing

Example

Each order should get the price band its quantity falls in. Join orders to bands with Inner and one key: qty between min_qty and max_qty. For customers who never ordered, join customers to orders with Left anti on customer_id = customer_id.