Keep name of source query in Union

  • Thread starter William McNeill
  • Start date
W

William McNeill

I have created a Union query combining the queries CEg, CMg, CSg, and CWg.
Works great. I need to know if there is any way to keep the name of the
source quiery in the rows of the Union query to identify where that record
came from. Thanks!!!!
 
R

Rob Parker

Hi William,

Easily done, by adding an additional field and setting the value in each
part of the union query. Something like:

SELECT Field1, Field2, "CEg" AS FromQuery FROM CEg
UNION
SELECT Field1, Field2, "CMg" AS FromQuery FROM CMg
....

HTH,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top