From ce921f603d288ba05721fbd6a02f6c0c4b3f05b7 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Tue, 17 Mar 2026 10:41:48 +0100 Subject: [PATCH] fix: correct SQL query syntax in Workflow A - replace NOT IN with LEFT JOIN for MariaDB compatibility - Use LEFT JOIN with IS NULL condition instead of NOT IN subquery - Change GROUP_CONCAT separator from '\n' to ',' (MariaDB syntax) - Query now successfully returns unprocessed conversations from Freescout DB - Verified: returns 20 conversations with proper data structure --- n8n-workflows/workflow-a-http.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n8n-workflows/workflow-a-http.json b/n8n-workflows/workflow-a-http.json index d7a577f..8809eee 100644 --- a/n8n-workflows/workflow-a-http.json +++ b/n8n-workflows/workflow-a-http.json @@ -26,7 +26,7 @@ }, "sendBody": true, "specifyBody": "json", - "jsonBody": "{\"query\":\"SELECT c.id, c.number, c.subject, c.customer_email, c.status, GROUP_CONCAT(t.body SEPARATOR '\\\\n') as threads_text FROM conversations c LEFT JOIN threads t ON c.id = t.conversation_id WHERE c.status = 1 AND c.id NOT IN (SELECT DISTINCT conversation_id FROM conversation_custom_field WHERE custom_field_id = 8) GROUP BY c.id LIMIT 20\"}" + "jsonBody": "{\"query\":\"SELECT c.id, c.number, c.subject, c.customer_email, c.status, GROUP_CONCAT(t.body SEPARATOR ',') as threads_text FROM conversations c LEFT JOIN threads t ON c.id = t.conversation_id LEFT JOIN conversation_custom_field ccf ON c.id = ccf.conversation_id AND ccf.custom_field_id = 8 WHERE c.status = 1 AND ccf.id IS NULL GROUP BY c.id LIMIT 20\"}" } }, {