Overview
This lesson is part of the n8n AI Automation - Zero to Hero course, Section: 3. Deep Dive Concepts.
Watch the video above for the full tutorial, or read the written guide below.
What Is the Merge Node in n8n?
The Merge node combines data from two or more separate branches of a workflow into one stream. It is how you bring back together results that were split earlier or fetched in parallel, so a single later node can work on the combined data.
How to Use the Merge Node in n8n
Connect two branches into the Merge node, then choose a mode. Append stacks all items from both inputs one after another. Combine joins them by matching field, by position, or by all possible combinations, which works like a SQL join on a shared key. Choose Branch passes through just one input. Use Combine "by matching fields" when you need to enrich one dataset with values from another using a common ID.
Key Takeaways
- n8n runs a workflow from left to right and top to bottom. So when one branch must run first, like orders before order details, place it at the top of the canvas.
- Append puts the items of each input one after the other. 100 order headers and 291 order lines came out as one long list, which suits branches that return the same kind of data.
- Combine by All Possible Combinations is a cross join: every order is paired with every order line, so 100 orders and 291 lines multiply into 29,100 items.
- Combine by Matching Fields on order ID joins each line to its order. Keep Matches works like an SQL inner join and returned the 291 matched lines, while Keep Non-Matches returns only the items with no partner.
- Keep Everything works like an outer join, Enrich Input 1 like a left join and Enrich Input 2 like a right join. With 4 orders that had no lines and 5 lines with no order, the lesson got 300, 295 and 296 items.
- If the two inputs name the key differently, for example order ID in one and ID in the other, switch on the option for different field names and enter the name from each input.
Related Lessons
- Lesson 11: How Branching works in n8n Workflows | Smart Automations with Multiple Paths
- Lesson 13: How to Use Set Node in n8n | Edit Fields Node | Add, Edit, Clean Data
- Lesson 14: How to Use Aggregate Node in n8n | Combine & Summarize Data
- Lesson 15: How to Use Remove Duplicates Node in n8n | Clean Your Data Fast
- Lesson 16: How to connect Google Forms & Webhook Node in n8n | Google Forms Integration
Next Steps
Continue your n8n journey with the full n8n AI Automation - Zero to Hero course.