The Merge node combines data from two branches by matching on a shared key.
The Merge node combines data from two branches by matching on a shared key. This is the n8n equivalent of a SQL JOIN and is the standard way to enrich records from one system with data from another. Fetch the base records in one branch, fetch the enrichment data in a parallel branch, and merge them by a common identifier.
Real-world example: You have a list of orders from Shopify and need to enrich each order with customer lifetime value (CLV) data from your analytics database.
Trigger
|
+-> Branch 1: Shopify - Get Recent Orders
| (returns: order_id, customer_email, total, created_at)
|
+-> Branch 2: PostgreSQL - Get Customer CLV
| (returns: email, lifetime_value, order_count, first_order_date)
|
Merge Node
Mode: Combine
Join: Inner Join (or Left Join to keep unmatched orders)
Match By: Field
Field 1: customer_email (from Shopify branch)
Field 2: email (from PostgreSQL branch)
```text
```sql title="PostgreSQL Node Query"
SELECT
email,
SUM(total_amount) as lifetime_value,
COUNT(*) as order_count,
MIN(created_at) as first_order_date
FROM orders
GROUP BY email;
```text
```json title="Merged Output (one item)"
{
"order_id": "ORD-5678",
"customer_email": "jane@example.com",
"total": 89.99,
"created_at": "2025-01-15T10:30:00Z",
"lifetime_value": 1247.50,
"order_count": 14,
"first_order_date": "2023-03-22T08:15:00Z"
}
```text
> **Tip: Merge Mode Reference**
>
> - **Inner Join:** Only items with matches in both branches (drops unmatched).
> - **Left Join:** All items from Branch 1, enriched with Branch 2 data where available (unmatched items have null enrichment fields).
> - **Append:** Combine all items from both branches into a single list (no matching, just concatenation).
The enriched data can now be used downstream: high-CLV customers get priority processing, first-time buyers get a welcome email, repeat customers get a loyalty discount.
**Related:** [Use Path Parameters in Webhook URLs for Dynamic Routing](../webhook-mastery/01-use-path-parameters-in-webhook-urls-for-dynamic-routing.md) | [Use Edit Fields in "Map Each" Mode for Simple Renames](../data-transformation/01-use-edit-fields-in-map-each-mode-for-simple-renames.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.