Skip to main content

Connecting Tables - Joins and Identifiers

Set up table joins for multi-table queries. Connect orders to customers, order lines to orders with primary and foreign keys.

Updated over 2 weeks ago

What You're Trying to Do

Your data is in separate tables and you want Zoë to answer questions that span multiple tables.

Quick Solution (5 minutes)

Set up joins with these 3 common patterns:

Step 1: Identify Your Key Fields

Most common patterns:

  • Orders → Customers: customer_id or customer_email

  • Order Lines → Orders: order_id

  • Events → Users: user_id or email

Step 2: Add Primary Key to Your Main Table

In your view file, add:

identifiers:
- name: order_id
type: primary
sql: ${order_id}

Step 3: Add Foreign Key to Your Secondary Table

In the related view file, add:

identifiers:
- name: order_id
type: foreign
sql: ${order_id}

Step 4: Deploy and Test

Click "Deploy to Production" then ask Zoë: "Show me customers and their total orders"

Getting data from multiple tables? You're all set! Zoë can now answer questions that span your connected tables.

Still Need Help?

Complete Guide For detailed join configuration and advanced patterns → Views - Identifiers and Data Modeling

Ask Zoë Directly Try asking: "What tables can be joined together?" to see your current join graph

Contact Support If joins aren't working or you're seeing duplicate data → Contact Support with "Table Join Issue" and include:

  • The tables you're trying to connect

  • The key fields that should link them

  • Example of what you're trying to query

Related Quick Guides

Did this answer your question?