Advanced Data Aggregation and SQL Join Techniques - n8n Workflow

Master data integration in your n8n workflow. This n8n templates guide demonstrates using the n8n node Merge for Inner Join, Left Join, and Union All operations on different datasets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users needing to combine data from multiple sources within an n8n workflow.

  • Developers familiar with SQL joins (Inner, Left, Union All) seeking equivalent functionality in n8n.

  • Technical users looking for advanced examples of the n8n Merge node capabilities.

  • Automation specialists building complex ETL processes using n8n templates.

Overview

Data aggregation is crucial in any robust automation solution. This demonstration n8n workflow provides practical examples of the three most common merging scenarios, analogous to standard SQL joins, using the core Merge n8n node.

By executing this n8n workflow, users can instantly see the inputs and outputs of different join types: an Inner Join (keeping only matching items), a Left Join (enriching the primary list with secondary data), and a Union All (combining two lists regardless of structure). This is a foundational n8n workflow for anyone handling structured data integration.

How it Works

This n8n workflow starts with an 'On clicking 'execute'' n8n trigger, which immediately initiates six separate data generation steps using Code nodes.


  1. Inner Join Example (Keep matching items): The 'A. Ingredients Needed' and 'B. Ingredients in stock' datasets are fed into the 'Ingredients in stock from recipe' Merge n8n node. Configured in Combine mode and matching on the Name field, the resulting dataset only contains ingredients present in both lists, similar to an SQL Inner Join.

  2. Left Join Example (Enrich Input): The 'A. Ingredients' list is merged with the 'B. Recipe quantities' list using the 'Merge recipe' n8n node. This node is set to Enrich Input 1. It ensures all items from A remain, and matching quantity data from B is added, effectively performing a Left Join.

  3. Union All Example (Combine all items): The 'A. Queen' and 'B. Led Zeppelin' band member lists are passed to the 'Super Band' Merge n8n node. Since no key fields are specified, this n8n node simply appends all items from B below all items from A, creating a single merged list, which acts like an SQL Union All.

This structured approach ensures that you understand how to use the versatile Merge n8n node to achieve precise data control in any advanced n8n workflow.

Installation Guide

To start using this data merging n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code.

  2. Open n8n: Go to your n8n instance and navigate to the 'Workflows' section.

  3. Create New: Click 'New' or 'Import from JSON' and paste the n8n workflow JSON.

  4. No Credentials Needed: This specific n8n workflow relies only on core nodes (Manual Trigger, Code, Merge) and requires no external service credentials.

  5. Execution: Click the 'Execute Workflow' button in the top right to run the 'On clicking 'execute'' n8n trigger and observe the outputs in the Merge nodes.

Node Details


  • On clicking 'execute' (Manual Trigger): The starting n8n trigger for the entire n8n workflow. Used for manual testing and demonstration.

  • Code Nodes (A. Ingredients Needed, B. Ingredients in stock, etc.): Six different Code n8n node instances are used to hardcode the input data (mock ingredients and band members) for demonstration purposes, allowing the Merge operations to be tested immediately.

  • Ingredients in stock from recipe (Merge n8n node): Performs an Inner Join. Key Configuration: Mode: Combine, Merge By Fields: Name. It only passes items found in both inputs.

  • Merge recipe (Merge n8n node): Performs a Left Join. Key Configuration: Mode: Combine, Join Mode: enrichInput1, Merge By Fields: Name. It enriches the primary input (A) with corresponding data from the secondary input (B).

  • Super Band (Merge n8n node): Performs a Union All operation. Key Configuration: Default settings. It simply appends the items from the second input stream (B. Led Zeppelin) to the first (A. Queen), demonstrating simple list concatenation within the n8n workflow.

Related n8n Workflows

Free

Nodes: 0 Nodes
Updated: December 26 2025
View all
Created by
Jonathan
Jonathan

Featured*