# MySQL node, how to query "equal to or more"?

**URL:** <https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226>\
**Category:** General\
**Created:** [26 January 2023 18:16 UTC](https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226 "2023-01-26T18:16:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![network\_potato](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@network\_potato](https://discourse.nodered.org/u/network_potato)\
**Post date:** [26 January 2023 18:16 UTC](https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226/1 "2023-01-26T18:16:24Z")

</div>

I am using `node-red-node-mysql` to query a database.

I want to return only the rows where the column `number` has a value of 5 or more.

```auto
msg.payload = ['>=5']

msg.topic = "SELECT * FROM myTable WHERE number = ?;"

return msg;

```

But this query returns 0 rows.

If I specify the number, it works:

```auto
msg.payload = [6]

msg.topic = "SELECT * FROM myTable WHERE number = ?;"

return msg;

```

Returns all rows where `number` is 6.

How do I write this query so it works the way I want it to?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [26 January 2023 18:40 UTC](https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226/2 "2023-01-26T18:40:35Z")

</div>

I don't use the node myself, so this is just a guess.

```auto
msg.payload = [5]
msg.topic = "SELECT * FROM myTable WHERE number >= ?;"
return msg;

```

---

<div class="post-metadata">

**Author:** ![network\_potato](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@network\_potato](https://discourse.nodered.org/u/network_potato)\
**Post date:** [27 January 2023 09:30 UTC](https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226/3 "2023-01-27T09:30:31Z")

</div>

Of course, why did I not think of that, so simple.. 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:** [10 February 2023 09:31 UTC](https://discourse.nodered.org/t/mysql-node-how-to-query-equal-to-or-more/74226/4 "2023-02-10T09:31:06Z")

</div>

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