Is it possible to give each Union query a “title” in SQL?
For example:
SELECT Name, Address
From Table1
Where .....
UNION
SELECT name, Address
From Table2
Where .....
Is it possible to label/alias the whole query from table 1 as “Results from table 1” and table 2 “results as table 2”
If there is a better way to do it, i.e. javascript, jquery, append tables together, etc, please let me know!
Tech Stack I am using:
SQL Server 2008, JSP, Servlets, javascript, jquery.
A union returns a set of results indistinguishable from a single query, add a column?
Or see if you client provider supports multiple recordsets and execute the 2 selects in a single batch, e.g. http://msdn.microsoft.com/en-us/library/ms378758.aspx