# Mysql - multiple queries in one line

**URL:** https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655
**Category:** General
**Created:** [3 June 2021 12:58 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655 "2021-06-03T12:58:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![chuckyro](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@chuckyro](https://discourse.nodered.org/u/chuckyro)
#### Post date: [3 June 2021 12:58 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/1 "2021-06-03T12:58:13Z")

</div>

hi,

simple question... is it possible to send to MySQL ... 2,3.. queries in one single line (topic) ?

eg:  
msg.topic = "select 1 ; select 2; select 3;" // .. of course here I'll have something more complex...

if I send that, I receive in payload:  
array[3]  
0: undefined  
1: undefined  
2: undefined

Thanks,

D.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [3 June 2021 13:25 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/2 "2021-06-03T13:25:10Z")

</div>

I don't believe it is possible as you have written it. What do you want to get back? Each select would return an array of records, so are you hoping to get an array of three (one for each select) where each element is itself the array recordset from the select?

---

<div class="post-metadata">

### Author: ![chuckyro](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@chuckyro](https://discourse.nodered.org/u/chuckyro)
#### Post date: [3 June 2021 14:09 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/3 "2021-06-03T14:09:50Z")

</div>

kind of .. I would expect in a complex example ..to receive 2-3 arrays of different length and values, of course.

another example ..one query/array with device\_details... and one query/array with device\_type\_details.

I could do that in 2-3 steps (in cascade) ..easily...but I just want one round to DB ! not 2 (or 3)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [3 June 2021 14:26 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/4 "2021-06-03T14:26:35Z")

</div>

No, I don't think you can do that. In fact I don't think the DB can do that in one go can it?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [3 June 2021 15:24 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/5 "2021-06-03T15:24:35Z")

</div>

You haven’t shown us rather actual queries - ie are they of the same table - but you should look up ‘MySQL or’ and see if that would work for you

---

<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: [2 August 2021 15:25 UTC](https://discourse.nodered.org/t/mysql-multiple-queries-in-one-line/46655/6 "2021-08-02T15:25:17Z")

</div>

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