Names of Tab from SQL Queries
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?
Seeing something other than the table to let me know what it is, is more useful.
Password Check, URL with Email, Banned
Add postfix to query result tabs so captions are unique. See http://www.heidisql.com/forum.php?t=10493
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;
/** * 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 SQlJust indicating how the doc blocks could be used. It would genuinely be useful to me, and I'm sure others too
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.
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.
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.
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.
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
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
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.
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.
I assume by the "somealias" work around you mean thstolte's post, right? If so, I try that and get an error (see screenshot). I'd love a way to add a comment above the query so I could identity the query result tab name easier.
(Using Version 22.214.171.12419 (64 Bit)) Thank you!
I guess the version has been updated so that you don't need the quotes around the label anymore. Try the following and it should work:
select mmcontactid from (select mmcontactid from tblnameContactCSIs) as whateverlabel where mmcontactid is not null
Yes this would be a nice-to-have. I'd put a bounty up for it if ansgar supported bounties. thstolte's solution worked for me by the way.
Even if the tab was named after the alias of the first table in the query, that would be great. Surely that would not require a large change in the codebase?
SELECT height, giantswhocanclimb FROM cliffs AS cliffsofinsanity WHERE location = 'insanity'
The tab would be labeled "cliffsofinsanity" instead of 'cliffs'?
Just an idea.
Anyways, thanks a gazillion for making HeidiSQL!!!
Please login to leave a reply, or register at first.