# Sqlite query not working with mustache query

**URL:** <https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607>\
**Category:** General\
**Tags:** node-red-dashboard, database\
**Created:** [25 July 2022 20:39 UTC](https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607 "2022-07-25T20:39:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![scoobie71](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@scoobie71](https://discourse.nodered.org/u/scoobie71)\
**Post date:** [25 July 2022 20:39 UTC](https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607/1 "2022-07-25T20:39:28Z")

</div>

I am using a template node to execute a query in sqlite using the msg.topic.  
My query is:

```auto
select * from rfidtaglist where id={{payload.id}};

```

On the debug i can see that in the query paylaod.id is replaced by an integer while it shoud be string.  
If i execute the query:

```auto
select * from rfidtaglist where id='2';

```

I do get a value back. How to force string inside using mustache?

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [25 July 2022 20:52 UTC](https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607/2 "2022-07-25T20:52:36Z")

</div>

hmm .. you could pass it from a Change node and make it to a string with a Jsonata Expression

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/b/6bbe5bc4dd7838ba7879911128d3b44f0c31466d.png)

But do you really need to ?

Cant you simply surround the numeric value with single quotes in the Template node directly ?

```auto
select * from rfidtaglist where id='{{payload.id}}';

```

sqlite should consider it as string

---

<div class="post-metadata">

**Author:** ![scoobie71](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@scoobie71](https://discourse.nodered.org/u/scoobie71)\
**Post date:** [25 July 2022 20:56 UTC](https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607/3 "2022-07-25T20:56:10Z")

</div>

Hummm. second option works fine.I'tried it before without success, maybe i was having a typo error. Many thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 August 2022 20:57 UTC](https://discourse.nodered.org/t/sqlite-query-not-working-with-mustache-query/65607/4 "2022-08-08T20:57:08Z")

</div>

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