Determining where the record is from in a Union Query

S

Samantha

I created a Union query, pulling identical field names from both tables. But
how can I know which table the record is from? Is there a way to do this?
thanks in advance
 
D

David Lloyd

Samantha:

One alternative is to create an extra field in your UNION query and populate
it with an identifier for each table, so that you can tie the records back
to the original tables. For example:

SELECT Field1, Field2, ..., "Table1"
FROM Table1
UNION
SELECT Field1, Field2, ..., "Table2"
FROM Table2

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I created a Union query, pulling identical field names from both tables. But
how can I know which table the record is from? Is there a way to do this?
thanks in advance
 
Top