|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: select with table name
From: Paul DuBois (paul
mysql.com)
Date: Sat Feb 16 2008 - 18:17:45 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 12:04 AM +0000 2/17/08, Miguel Vaz wrote:
> Hi,
>
> I have a small issue that i can get my head around to solve:
>
> Is it possible to do a select from two tables using a union
>all (select * from t1 union all select * from t2), and have it
>display the table name in front of each row?
mysql> select 't1', t1.* from t1 union select 't2', t2.* from t2;
+----+------+
| t1 | i |
+----+------+
| t1 | 1 |
| t2 | 2 |
| t2 | 3 |
+----+------+
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]