Join on multiple keys with EXTEND()

The EXTEND operation can add multiple fields to elements of an array of rows based on foreign key relationships.

This is the generalization of RELATED() for arrays of rows.

Syntax

EXTEND(
    <array_of_rows>
    WITH <feature> (, <feature>)*
    VIA <field> (, <field>)* BOUND TO <feature> (, <feature>)*
)
sql

Where:

  • Each source_column is a column containing values you want to copy
  • Each alias is the name for the added field in the output row
  • array_of_rows is a column containing arrays of rows with foreign keys that reference the primary keys in the source columns' tables

To be valid, <feature1>, <feature2>... need to be fully defined by the [... list of features] binding.

Interactive examples

The examples on this page use data and features from the Datasets page, which will be created automatically if needed.

foreign keys ↔ primary key (join)

foreign keys ↔ foreign key (aggregation + join)

Coming soon

This capability is not yet available.

Relationship to RELATED()

The EXTEND() operation is the general-purpose mechanism for joining features across entities. The RELATED() function family provides a more concise and easier to understand syntax for simple cases.

Use RELATED() if possible, and EXTEND() when you need work with many foreign keys or require more explicit control over the binding logic.

foreign key ↔ primary key

foreign key ↔ foreign key

Last update at: 2025/12/05 16:03:14
Last updated: 2025-12-05 16:07:55