Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.

Names of Tab from SQL Queries

DB Phantom's profile image DB Phantom posted 7 years ago in Feature discussion
Currently the name of the tabs for a SQL query is the name of the table.

I will run 3 - 7 queries all using the same base table for searching. The results is I get multple tabs with the same name on the tab.

Is there a way to have the tabs named something a little more useful?
ansgar's profile image ansgar posted 7 years ago
The tab caption is set automatically, by analyzing the query. I could add a postfix so they are unique, e.g. "mytable #1", "mytable #2" etc. But is that what you mean by "more useful"?
DB Phantom's profile image DB Phantom posted 7 years ago
My queries are slightly different. For instance, I need to run 3 queries against the Users DB for 3 very different reasons. Seeing Users 3 times isn't useful.

Seeing something other than the table to let me know what it is, is more useful.
Password Check, URL with Email, Banned

Just examples.


Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.
ansgar's profile image ansgar posted 7 years ago
Well, "Password Check" or "URL with Email" is nothing I can name automatically, as you might imagine. That's why I asked if "mytable #x" is more useful for you.
DB Phantom's profile image DB Phantom posted 7 years ago
That's better than thesame name over and over again. :)
Ash501's profile image Ash501 posted 7 years ago
Perhaps the name of the snippet that it's saved into, or the query file you save it into would be more user friendly.....
Ash501's profile image Ash501 posted 7 years ago
any other query and your on your own....smile
Ash501's profile image Ash501 posted 7 years ago
Don't get what you mean, DB Phantom:

"Currently the name of the tabs for a SQL query is the name of the table"

It just shows query#1 result#1 etc... by me!?

i'm messing something?
DB Phantom's profile image DB Phantom posted 7 years ago
I will run several quries at one time. Therefore I will get the table name for the SELECT as the tab name. So if I run several that users is the main table from the SELECT (not counting JOIN tables) I will have several tabs called users.
ansgar's profile image ansgar posted 7 years ago
r4127 adds a " #2", " #3" etc. postfixes to identical tab captions.


Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.
Ash501's profile image Ash501 posted 7 years ago
what happens if you have multiple queries for same table? we're back to same problem, no?

seems the name of snippet/or saved query, would be far more user friendly....clear and adjustable to more scenarios.

my 2 cents anyway...
ansgar's profile image ansgar posted 7 years ago
> what happens if you have multiple queries for same table?

Please read my above comment - I added the #2, #3 ... postfix for exactly that situation.

The name of the snippet or saved query would not help, as that is the same for all results, isn't it? You do not execute different snippets for each result grids. By the way, we're not talking about query tabs - what DB Phantom means is the tab captions of the result grids in one query tab. One query tab can have multiple result grids, one grid per result, e.g. if you exceute such queries at once:
SELECT * FROM table1;
SELECT * FROM table2;
DB Phantom's profile image DB Phantom posted 7 years ago
OK- just got the nightly build and tried it out. This will work thanks. :)
Ash501's profile image Ash501 posted 7 years ago
Just wondering if this is a good idea...
How about using the commenting text for example:

/* Report A */
SELECT * FROM table1;
/* Report B */
SELECT * FROM table1;

Now each result tab could be named: Report A, Report B.
ansgar's profile image ansgar posted 7 years ago
You would have to write a comment just to have the tab named after it. Isn't that manual work for the user for a minimal effect?
Antnee's profile image Antnee posted 6 years ago
Hi. I would actually be very interested in being able to set custom names for these tabs somehow. I have a report that I run that is an SQL file with multiple queries, and it comes up as "Result #1", "Result #2" etc. I do have comments in my SQL so that someone reading it (maintaining etc) knows what each query is doing. It would be nice if we could so something like JavaDoc or PHPDoc where we could put something like this:

/**
* Monthly Sales Query
* 
* @label Monthly Sales
*/
SELECT sum(*) AS total
, month(sell_date) AS month
FROM sales
GROUP BY month;
/**
* Yearly Sales Query
* 
* @label Yearly Sales
*/
SELECT sum(*) AS total
, year(sell_date) AS year
FROM sales
GROUP BY year;


Please don't use my queries as example of good SQlwinkJust indicating how the doc blocks could be used. It would genuinely be useful to me, and I'm sure others too
Antnee's profile image Antnee posted 6 years ago
Wow, just spotted so many things wrong with those example queries :D
kalvaro's profile image kalvaro posted 6 years ago
This is a 9 month old thread. HeidiSQL is basically an administration tool and one of its key points is simplicity. (If you want to get lost in your MySQL client you already have Toad for MySQL.)

IMHO, creating a annotation syntax with its corresponding documentation, parser and use cases goes far beyond the abilities that are reasonable to expect from such a tool. I can't think of any other usage apart from running reports and if we want HeidiSQL to be a decent reporting tool it'll lack tons of other basic features.

If you need to run those reports regularly you should invest a few hours writing an application, possibly a PHP-driven web site or even an Excel spreadsheet.
kalvaro's profile image kalvaro posted 6 years ago
P.S. To be honest, my experience with TOAD is only with their good old Oracle version. It's possible that their MySQL release has a better usability.
Antnee's profile image Antnee posted 6 years ago
OK, firstly, the age of the thread does not change the fact that this is a feature that I've wanted for a while. Adding a tiny little bit of processing such as this also doesn't add any complexity to the application, if you're perfectly honest. It certainly won't require massive documentation, will it? Also, why would I want to write an application or framework to get data out, when Heidi already does it brilliantly? Quickly knock up a query, export data as CSV (or whatever is required), save the SQL file for later use, done.

Heidi is an excellent tool that I've been using for donkeys, but there's no single feature that makes it a killer app, but rather a collection of MANY small features that just makes it indispensable, IMHO. Being able to label the tabs in a multi-query is just another small feature that I'd love to have. It's hardly a deal-breaker, but it would make it much simpler to read the results. The alternative for me is to have the results contain a field that describes what I'm looking at (so making the beginning of the query SELECT 'YEARLY') for example. That sucks.
wrek's profile image wrek posted 4 years ago
Look! Now it's been two MORE years...

I came here because I was searching for a way to help me differentiate the different tabs.

See attached image example.

I have several Selects and the first one is from "vw_SomeView". Every tab is labeled "vw_SomeView" even though all of the other selects are from other tables.
1 attachment(s):
  • Wut
david.castell's profile image david.castell posted 3 years ago

I have a similar use case. I paste in a query that has 7 selects. If I can name the tabs then I can easily see what is what. Otherwise I have to check tab position against position of the select command. That's not too hard, but when mentally juggling other things it is a distraction.

I find HeidiSQL a very good tool and this would be a useful addition for me.

dtavres's profile image dtavres posted 3 years ago

On HeidiSQL Help I see a solution, but my queries aren't as simple as the example.

I'm hoping I'm missing something.

Here's one of my queries: select from(select date(FROM_UNIXTIME(joinStamp-83600)) as date, count(*) from base_user group by 1 order by date DESC LIMIT 20 ) sub order by date ASC;

*I'm a new user, so I can't include the reference - so search google for: heidisql Screenshot: Multiresults

1 attachment(s):
  • multiresults-2-
TiaHunt's profile image TiaHunt posted 2 years ago

I was reading through the comments, hoping to find a solution to the problem of having multiple results tabs with the same name, though I don't see that this has been solved. So I'm commenting to show interest in a solution :)

AndyJ's profile image AndyJ posted 2 years ago

joining in - yes, I agree this would be useful. Perhaps the app could continue as is with it's current naming but allow you to say double click a tab and give it a different name if you choose to..

thstolte's profile image thstolte posted 1 year ago

So I found I way to make this work. instead of doing a query like the following:

select col1, col2 from table1
where col1 is not null;

change it up to be like this:

select col1, col2 from (select col1, col2 from table1) as 'WhateverLabel'
where col1 is not null;

and the tab will show up as WhateverLabel. It's a little redundant, but at least the tabs are labeled what you want.

Hope this helps

qupear's profile image qupear posted 10 months ago

You would have to write a comment just to have the tab named after it. Isn't that manual work for the user for a minimal effect?

When you do an important updates of data you need to be 100% sure where goes each bit of data and from which tab you take this data. But when there are users#1 users#2 you have to remember what you need to do with #1 and #2. But if you once named your tabs you then can use them later no matter how far thought process gone.

mike1671's profile image mike1671 posted 5 months ago

Or use your select statement to create a temp table named resultset1 and then select * from it afterward, and tab will be named more specific

muzza4's profile image muzza4 posted 5 months ago

Or use your select statement to create a temp table named resultset1 and then select * from it afterward, and tab will be named more specific

Sure, but that's no good if you want to update a row.

I'd favour a comment directly before the query that HSQL uses to name the tab e.g.

# My Tab 1

select * from etc

If it's not there then use default naming, if it's too long than truncate.

Cheers Muzza

Please login to leave a reply, or register at first.