KEEP LEARNING
Build the bigger picture.
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
Tips > Data, APIs & Webhooks
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.
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.
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
KEEP LEARNING
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
APPLY IT TO YOUR SYSTEM
Bring the process, the tools involved and an example of where the current workflow gets stuck.