Mysql module grouping output by ID

Describe the problem/error/question

STEP 1) I am using the mySQL module to query unique records by ID

STEP 2) I am using the mySQL module to utilize the ID from step 1 to query related records. The output from this step could be 1 or more than one related record

STEP 3) I am taking the output from Step 2 and converted it into an HTML Table

STEP 4) I am sending an email with the output from Step 3

The PROBLEM that I am having is that Step 2 output’s ALL data for all ID’s, and then sends ALL ID’s from Step 1 into Step 2 in a single run. As a result the table in Step 3 is a list of ALL data from Step 2. Instead, I need individual tables by ID from Step 2.

I am coming transitioning this workflow from Make and I am taking for granted some of the features of Make where runs are split into separate batches.

You can see in the image above that Step 1 produced 2 items. These 2 items are 2 unique ID’s. Step 2 produces 7 items, but 4 items are related to one ID and 3 items are related a second ID. See further below.

Essentially I need Step 3 to produce two tables. One for the related records of the first unique ID and another for the related records of the second ID. And I need this process to iterate until ID N…

Information on your n8n setup

  • n8n version: 1.57
  • Database: default: SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via: Docker
  • Operating system: Ubuntu

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

I was able to solve it with the loop module!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.