How to Display Table Names in query tab??

[expired user #5023]'s profile image [expired user #5023] posted 14 years ago in General Permalink
when I create and run a query (in the query tab) that selects from or joins several tables, How do I get the table name to display in the results along with the fields names?

Thank you,
~Donavon
ansgar's profile image ansgar posted 14 years ago Permalink

How do I get the table name to display in the results



You mean, that HeidiSQL is displaying "Result #1", "Result #2" and so forth? That's for cases in which the table name is not determinable, as you say with joins.
[expired user #5023]'s profile image [expired user #5023] posted 14 years ago Permalink
This is what I would like to do.

select t1.field1, t2.field1
from table1 t1, table2 t2

CURRENT OUTPUT:
field1 field1
blablabla blablabla
blablabla blablabla
blablabla blablabla

OUTPUT IM LOOKING FOR:
t1.field1 t2.field1
blablabla blablabla
blablabla blablabla
blablabla blablabla
[expired user #5023]'s profile image [expired user #5023] posted 14 years ago Permalink
Sorry. I can't edit my posts and I wanted to add this..

In other words I have more then one table with the same field names. When I do a select in the query tab just the field names show up, so I don't know which field name is from which table.
ansgar's profile image ansgar posted 14 years ago Permalink
Ah I see. Makes sense for joins but feels ugly when you do some simple SELECT * FROM tbl doesn't it?
kalvaro's profile image kalvaro posted 14 years ago Permalink
Just assign aliases:

select t1.field1 AS 't1.field1', t2.field1 AS 't2.field1'
from table1 t1, table2 t2


HeidiSQL displays names in the same way any other SQL tool. Anything else would be confusing IMHO.

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