Mysql node, delete unable to pass variable

Describe the problem/error/question

I want to delete certain records from mysql based on a condition. The value for condition is received from previous node. To achieve this I am using MySQL node, with operation => Execute Query. My query looks like this delete from analytics_dashboardwhereanalytics_dashboard.event_id like "% {{ $json.calendar_event_id }} %"

What is the error message (if any)?

ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘calendar_event_id"]}}%"’ at line 1

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • Version 0.236.3
  • SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
    -Docker
  • Linux

Hey @Saurabh_Periwal,

Try something like the below, That is working for me in newer n8n versions.

delete from `analytics_dashboard` where `analytics_dashboard`.`event_id` LIKE  {{ '"%' +  $json.calendar_event_id + '%"' }}

Thank you Jon. While the node was able to assign the value to variable from previous nodes. But while executing, I see following error
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{ '"%' + $json.calendar_event_id + '%"' }}' at line 1

Hey @Saurabh_Periwal,

Can you try updating your n8n install to v1 and see if that changes anything?