Rayne
asked on
Get the table name in Union Select too?
Hello,
I am trying to query several tables that have the same 3 columns and combine the results like this.
Select col1,col2,col3 from tblA
union
Select col1,col2,col3 from tblB
union
Select col1,col2,col3, from tblC
From
The end result who not only show me the union of three columns form all the tables but also - which is there source table as well like this
Col1 | col2 | col3 | myTableName
Er | ty | rt } tblA
Er | ty | rt } tblB
I am trying to query several tables that have the same 3 columns and combine the results like this.
Select col1,col2,col3 from tblA
union
Select col1,col2,col3 from tblB
union
Select col1,col2,col3, from tblC
From
The end result who not only show me the union of three columns form all the tables but also - which is there source table as well like this
Col1 | col2 | col3 | myTableName
Er | ty | rt } tblA
Er | ty | rt } tblB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hehehe I won by 11 seconds LOL
ASKER
thank you both :)