Tips > Data, APIs & Webhooks

Use the Merge Node's Combine Mode with Key Matching to Join Data

The Merge node in **Combine > Merge By Fields** mode performs the equivalent of a SQL JOIN between two n8n data streams.

Use the Merge node in Combine, Merge By Fields mode to join two n8n data streams like a SQL JOIN. Set the key field for each input, choose whether to keep only matches or everything, and pick clash handling for overlapping fields. It enriches records from one source with data from another and replaces a complex Code node full of nested loops.

What does the Merge node's Combine mode do?

The Merge node in Combine > Merge By Fields mode performs the equivalent of a SQL JOIN between two n8n data streams. This is essential whenever you need to enrich records from one source with data from another.

Real-world example: Input 1 contains customer records from your CRM (HubSpot). Input 2 contains recent order data from your database. You want to merge them on email to produce an enriched customer record.

How do you configure Merge By Fields to join data?

Workflow structure:

[HubSpot Node] ──────► [Merge Node] ──────► [Output]
                           ▲
[Postgres Node] ───────────┘

Configure the Merge node:

Setting Value
Mode Combine
Combination Mode Merge By Fields
Input 1 Field email
Input 2 Field customer_email
Output Type Keep Matches
Clash Handling Prefer Input 2 (order data wins)
// Input 1 (HubSpot) item:
{ "email": "jane@acme.com", "name": "Jane Doe", "lifecycle_stage": "customer" }

// Input 2 (Postgres) item:
{ "customer_email": "jane@acme.com", "last_order_date": "2025-03-15", "total_spent": 4250.00 }

// Merged output:
{
  "email": "jane@acme.com",
  "name": "Jane Doe",
  "lifecycle_stage": "customer",
  "last_order_date": "2025-03-15",
  "total_spent": 4250.00
}

Note: Handling Unmatched Records. Set Output Type to Keep Everything if you want to include customers who have no orders (a LEFT JOIN equivalent). Unmatched fields will be null.

This replaces what would otherwise be a complex Code node with nested loops and is significantly easier to maintain.

Related: Flatten Deeply Nested API Responses · Use the HTTP Request Node as a Universal Connector

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call