On Tue, 2003-03-11 at 07:33, Richard Taubo wrote:
> 
> When using the Union statement in MySQL, is it possible to retrieve the 
> corresponding table name for a given row? The reason I need to know 
> this is that I present info from different tables in their own way. I 
> know I can create a column in each table that describes which table the 
> row actually is being retrieved from, but I am looking for a more 
> intelligent solution.
> 

Couldn't you include the table name in the select clauses of the
union ?

eg.

select 'table_1' table, t1.* from table_1 t1 where blah and blah
union
select 'table_2' table, t2.* from table_2 t2 where blah and blah

==
Martin


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to