# Mysql node, delete unable to pass variable

**URL:** <https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964>\
**Category:** Questions\
**Tags:** mysql\
**Created:** [August 4, 2023, 11:59am UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964 "2023-08-04T11:59:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurabh\_Periwal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/saurabh_periwal/32/14600_2.png) [@Saurabh\_Periwal](https://community.n8n.io/u/Saurabh_Periwal)\
**Post date:** [August 4, 2023, 11:59am UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964/1 "2023-08-04T11:59:23Z")

</div>

## 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\_dashboard`where`analytics\_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

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [August 4, 2023, 2:09pm UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964/3 "2023-08-04T14:09:47Z")

</div>

Hey @Saurabh_Periwal,

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

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

```

---

<div class="post-metadata">

**Author:** ![Saurabh\_Periwal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/saurabh_periwal/32/14600_2.png) [@Saurabh\_Periwal](https://community.n8n.io/u/Saurabh_Periwal)\
**Post date:** [August 4, 2023, 3:10pm UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964/4 "2023-08-04T15:10:54Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [August 7, 2023, 7:41am UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964/5 "2023-08-07T07:41:18Z")

</div>

Hey @Saurabh_Periwal,

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

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [November 5, 2023, 7:41am UTC](https://community.n8n.io/t/mysql-node-delete-unable-to-pass-variable/28964/6 "2023-11-05T07:41:24Z")

</div>

Closed on November 5, 2023, 7:41am UTC

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