Workflow: Compare 2 SQL datasets
Integrations: compareDatasets, manualTrigger, mySql, set, stopAndError

{"id": "emPRhyWgxygwHgWh", "meta": {"instanceId": "workflow-b64734d3", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:50.178381", "updatedAt": "2025-09-29T07:07:50.178390", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "name": "Compare 2 SQL datasets", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "nodes": [{"id": "df04c503-d4af-4e8f-bcc3-f1fd02d3a332", "name": "When clicking \"Execute Workflow\"", "type": "n8n-nodes-base.manualTrigger", "position": [780, 340], "parameters": {}, "typeVersion": 1, "notes": "This manualTrigger node performs automated tasks as part of the workflow."}, {"id": "6fe78ae6-7325-4062-ab58-457dc1d985c4", "name": "Compare Datasets", "type": "n8n-nodes-base.compareDatasets", "position": [1560, 320], "parameters": {"options": {"multipleMatches": "all"}, "mergeByFields": {"values": [{"field1": "customerNumber", "field2": "customerNumber"}, {"field1": "year", "field2": "year"}]}}, "typeVersion": 2.3, "notes": "This compareDatasets node performs automated tasks as part of the workflow."}, {"id": "0dae008c-242d-4757-a5a4-a075bde54cb6", "name": "Orders from 2003 and 2004", "type": "n8n-nodes-base.mySql", "position": [1080, 220], "parameters": {"query": "SELECT customerNumber, SUM(amount) as Total, COUNT(*) as ordercount, YEAR(paymentDate) as year\nFROM payments\nWHERE YEAR(paymentDate) = '2003' OR YEAR(paymentDate) = '2004'\nGROUP BY customerNumber, year\n;", "options": {}, "operation": "executeQuery"}, "credentials": {"mySql": {"id": "EEPqCgKBDiRRZ3ua", "name": "db4free MySQL"}}, "typeVersion": 2.1, "notes": "This mySql node performs automated tasks as part of the workflow."}, {"id": "c162e9b5-6e26-4a81-b90d-a5709e73019c", "name": "Orders from 2004 and 2005", "type": "n8n-nodes-base.mySql", "position": [1080, 440], "parameters": {"query": "SELECT customerNumber, SUM(amount) as Total, COUNT(*) as ordercount, YEAR(paymentDate) as year\nFROM payments\nWHERE YEAR(paymentDate) = '2004' OR YEAR(paymentDate) = '2005'\nGROUP BY customerNumber, year\n;", "options": {}, "operation": "executeQuery"}, "credentials": {"mySql": {"id": "EEPqCgKBDiRRZ3ua", "name": "db4free MySQL"}}, "typeVersion": 2.1, "notes": "This mySql node performs automated tasks as part of the workflow."}, {"id": "05547a67-2c53-43df-8abd-ee356f12742b", "name": "Change ordercount", "type": "n8n-nodes-base.set", "position": [1300, 440], "parameters": {"values": {"number": [{"name": "ordercount", "value": 1}]}, "options": {}}, "typeVersion": 2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "error-e37ebd42", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [1000, 400], "parameters": {"message": "Workflow execution error", "options": {}}}], "active": false, "pinData": {}, "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "versionId": "9680b087-de3a-4179-8f48-5e2ae9dc6fac", "connections": {}, "description": "Automated workflow: Compare 2 SQL datasets. This workflow processes data and performs automated tasks.", "notes": "Excellent quality workflow: Compare 2 SQL datasets. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}