# Multiple Queries

**URL:** <https://forums.toadworld.com/t/multiple-queries/39596>\
**Category:** Toad Edge\
**Created:** [June 16, 2017, 3:51pm UTC](https://forums.toadworld.com/t/multiple-queries/39596 "2017-06-16T15:51:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpaine](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/tpaine/32/270_2.png) [@tpaine](https://forums.toadworld.com/u/tpaine)\
**Post date:** [June 16, 2017, 3:51pm UTC](https://forums.toadworld.com/t/multiple-queries/39596/1 "2017-06-16T15:51:28Z")

</div>

When I run multiple queries in the same window like this:

select \* from brand b;

select \* from blog;

I only see the results for the last query, in this case “Blog”. The window at the top says “2 statements processed” but I’m not seeing two results sets.

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dvohra/32/252_2.png) [@dvohra](https://forums.toadworld.com/u/dvohra)\
**Post date:** [June 18, 2017, 9:01am UTC](https://forums.toadworld.com/t/multiple-queries/39596/2 "2017-06-18T09:01:42Z")

</div>

The result generated would be based on the option used to run SQL statements. Which of the following options is used to run the multiple SQL statements?

1. Execute All Statements
2. Execute from Current Position
3. Execute To Current Position
4. Execute SQL Statement  
If the cursor is not positioned on any SQL Statement and **Execute All Statements** is selected no result set is displayed.

To run multiple SQL queries:

1. Add multiple SQL Queries in same worksheet.

 ![MultipleSQLQueries.jpeg](https://global.discourse-cdn.com/quest/original/2X/9/9d3569c8e377be62490c49a36a7da3d0737bce55.jpeg)

1. Position cursor at the start of the 1st SQL Statement and click on **Execute SQL Statement**.

 ![Run1stQuery.jpeg](https://global.discourse-cdn.com/quest/original/2X/c/c6dfa32a631ac87d9734966bb9ddbbb69d1360c1.jpeg)

1. **Result** from 1st SQL Query is displayed.

 ![ResultFrom1stQuery.jpeg](https://global.discourse-cdn.com/quest/original/2X/a/a1ab7120ecb8294742151e8abe12885b5ca330c7.jpeg)

1. Position cursor at the start of 2nd SQL statement and click on **Execute SQL Statement**.

 ![Run2ndQuery.jpeg](https://global.discourse-cdn.com/quest/original/2X/c/c11507642674655750601fc4d7da46f493809767.jpeg)

1. **Result** from 2nd SQL Query is displayed.

 ![ResultFrom2ndQuery.jpeg](https://global.discourse-cdn.com/quest/original/2X/4/43d3ba73f5a416bc1be9e86572aa63b1ed76ce05.jpeg)

---

<div class="post-metadata">

**Author:** ![Lukas.Knapek](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/lukas.knapek/32/269_2.png) [@Lukas.Knapek](https://forums.toadworld.com/u/Lukas.Knapek)\
**Post date:** [June 19, 2017, 1:58am UTC](https://forums.toadworld.com/t/multiple-queries/39596/3 "2017-06-19T01:58:32Z")

</div>

Hi Thomas,

Unfortunately, you cannot view results of multiple select statements in one query at the moment. If you need to do that, you will have to display them one by one as per Deepak’s walkthrough.

I created a CR for this improvement in our backlog so it might be implemented at some time in the future.

Thank you,

Lukas

---

<div class="post-metadata">

**Author:** ![tpaine](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/tpaine/32/270_2.png) [@tpaine](https://forums.toadworld.com/u/tpaine)\
**Post date:** [June 19, 2017, 9:57am UTC](https://forums.toadworld.com/t/multiple-queries/39596/4 "2017-06-19T09:57:14Z")

</div>

Thank you for the detailed response Deepak, but I’m well aware of how it’s possible to get the results I want in 5 separate steps but it shouldn’t be that hard. Toad for MySQL gets it done in one.

---

<div class="post-metadata">

**Author:** ![tpaine](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/tpaine/32/270_2.png) [@tpaine](https://forums.toadworld.com/u/tpaine)\
**Post date:** [June 19, 2017, 9:59am UTC](https://forums.toadworld.com/t/multiple-queries/39596/5 "2017-06-19T09:59:00Z")

</div>

That would be great Lukas. I appreciate that Toad Edge is probably a complete re-write and I love that it’s native to the Mac but there are number of ways in which using it is more difficult. To the point where I’m still willing to run Windows through Parallels for the sole purpose of using Toad for MySQL.

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dvohra/32/252_2.png) [@dvohra](https://forums.toadworld.com/u/dvohra)\
**Post date:** [June 20, 2017, 3:37am UTC](https://forums.toadworld.com/t/multiple-queries/39596/6 "2017-06-20T03:37:04Z")

</div>

If none of the transactional limitations being added multiple SQL statements should be able to be run in the same transaction.

[http://download.nust.na/pub6/mysql/doc/refman/5.1/en/mysql-cluster-limitations-transactions.html](http://download.nust.na/pub6/mysql/doc/refman/5.1/en/mysql-cluster-limitations-transactions.html)

TOAD for MySQL does display two results for two SQL SELECT statements in the same run. Would be a suitable feature to add to TOAD Edge also.

---

<div class="post-metadata">

**Author:** ![ScottM.Sanders](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/scottm.sanders/32/93_2.png) [@ScottM.Sanders](https://forums.toadworld.com/u/ScottM.Sanders)\
**Post date:** [January 17, 2018, 11:10am UTC](https://forums.toadworld.com/t/multiple-queries/39596/7 "2018-01-17T11:10:21Z")

</div>

Toad Edge should also save Result tabs of past queries per session like Toad for MySQL did.

---

<div class="post-metadata">

**Author:** ![shalvie](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@shalvie](https://forums.toadworld.com/u/shalvie)\
**Post date:** [February 12, 2018, 1:33am UTC](https://forums.toadworld.com/t/multiple-queries/39596/8 "2018-02-12T01:33:45Z")

</div>

> [@](#):
>
> Toad Edge should also save Result tabs of past queries per session like Toad for MySQL did.

hear hear!

---

<div class="post-metadata">

**Author:** ![dvohra10](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dvohra10/32/10728_2.png) [@dvohra10](https://forums.toadworld.com/u/dvohra10)\
**Post date:** [February 12, 2018, 10:19am UTC](https://forums.toadworld.com/t/multiple-queries/39596/9 "2018-02-12T10:19:30Z")

</div>

Past queries would be suitable as Results History, but only for a Session.

---

<div class="post-metadata">

**Author:** ![shalvie](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@shalvie](https://forums.toadworld.com/u/shalvie)\
**Post date:** [February 12, 2018, 9:54pm UTC](https://forums.toadworld.com/t/multiple-queries/39596/10 "2018-02-12T21:54:38Z")

</div>

It doesn’t tell you the run time. So if I want to compare how long one stored procedure took and then make some changes and run it again, I have to physically write down the time. If I want to check the results of two queries or procedures are the same I need to export the data to compare them.

---

<div class="post-metadata">

**Author:** ![dvohra10](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dvohra10/32/10728_2.png) [@dvohra10](https://forums.toadworld.com/u/dvohra10)\
**Post date:** [February 13, 2018, 11:16am UTC](https://forums.toadworld.com/t/multiple-queries/39596/11 "2018-02-13T11:16:48Z")

</div>

Toad Edge does provide Schema comparison.

[www.quest.com/…/](https://www.quest.com/video/how-to-compare-database-schema-in-toad-edge8123161/)

Regarding comparing time for query the time would vary even for the same query over multiple runs. Has running same query over multiple runs been tested? Time for query could vary due to several factors such as:

-Other queries running concurrrently  
-CPU and RAM available  
-Other processes running  
-Whether single thread or multiple thread CPU is used

---

<div class="post-metadata">

**Author:** ![shalvie](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@shalvie](https://forums.toadworld.com/u/shalvie)\
**Post date:** [February 13, 2018, 10:18pm UTC](https://forums.toadworld.com/t/multiple-queries/39596/12 "2018-02-13T22:18:07Z")

</div>

Hi,

Schema comparison is not relevant to this issue. I am looking at queries in the same database and not schema changes.

This has to do with development. I always used the toad freeware because it was excellent for development purposes (ie stored procedures, functions etc.) which is a big part of applicative side of the job of a DBA. The only reason I looked at toad Edge is because it has the tendency to freeze and crash and sometimes lose things I needed.

When running a call to a stored procedure and making changes - as you may be changing the code to fix an issue, add support for additional input variables or optimize the run time, to give some examples, the results can be different if you mess something up in the logic. The data can be slightly different based on the changes in the incoming variables (such as for example if you change parameters like order by and row limits). Sometimes something you add will slow down or speed up the runtime and you want to check back between versions. Sometimes you just need to make sure the data with one version is the same with the new version of the stored procedure. These are the main reasons why I liked to check the data and run times of previously run queries. Sometimes I forgot the parameter I got from an earlier query and wanted to go back to check that the information was correct or consistent without having to run the query over again in another window so as not to lose the data I was looking at.

I hope this explains the issue more clearly.

Additionally I find when I go some googling that the features that Toad Edge for MySQL are lacking exist in the version for SQL Server so I know that these are things that are important to other people using the software.

Thanks.

---

<div class="post-metadata">

**Author:** ![dvohra10](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dvohra10/32/10728_2.png) [@dvohra10](https://forums.toadworld.com/u/dvohra10)\
**Post date:** [February 14, 2018, 9:08am UTC](https://forums.toadworld.com/t/multiple-queries/39596/13 "2018-02-14T09:08:15Z")

</div>

Regarding support for multiple Results refer Lukas Knapek’s reply:

“I created a CR for this improvement in our backlog so it might be implemented at some time in the future.”
