# Using mysql node but no joy with insert query

**URL:** <https://discourse.nodered.org/t/using-mysql-node-but-no-joy-with-insert-query/29234>\
**Category:** General\
**Created:** [30 June 2020 13:36 UTC](https://discourse.nodered.org/t/using-mysql-node-but-no-joy-with-insert-query/29234 "2020-06-30T13:36:23Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [30 June 2020 15:10 UTC](https://discourse.nodered.org/t/using-mysql-node-but-no-joy-with-insert-query/29234/3 "2020-06-30T15:10:34Z")

</div>

Actually, I decided that using a function was a better model, making it easier to debug, and got the following working. Given the using the ? mark notation was proving programmatic.

```auto
var theValues = msg.payload.split(',');
var theFields = msg.topic;

msg.topic = `INSERT INTO Ambient(`+theFields+`) VALUES (`+theValues+`);`;
msg.payload=null;

return msg;

```

The above of course send to the SQL node to process accordingly. I will test what you suggested as well. Thanks for the reply.

---

_[View the full topic](https://discourse.nodered.org/t/using-mysql-node-but-no-joy-with-insert-query/29234)._
