The Merge node in **Combine > Merge By Fields** mode performs the equivalent of a SQL JOIN between two n8n data streams.
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] ───────────┘
```text
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) |
```json
// 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
}
```text
> **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](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use the HTTP Request Node as a Universal Connector](../integration-patterns/01-use-the-http-request-node-as-a-universal-connector.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.