Unanswered: help with adding unique column to union query
Let me first start this with saying that I'm very new to Access and SQL (Intern new) so please bare with me.
The db which I was given was compiled of about 40 tables all from different periods which they were completed. I found that in order to simply the process of analyses I would build one master table and run comparison queries off of that. I eventually decided to do a union query in sql to put the tables together, first month-by-month, then year-by-year and finally they are all housed in one master table ready for analysis.
I am now finding it may be useful to know the source of each entry in the master table (i.e. what table did it originally come from). Is there any sql syntax that I can run with the union query that will add a column to each entry with the title of the table it came from?
Or would I have to go back into each table and manually add the column with the table name and then rerun the union queries? If so, is there a way I could build a macro to do this?
Thanks for any help, again I'm very new so any tip/tricks are greatly appreciated!
here's some sample code of the union:
Select * from 02282012_1
so what I want to do is for example have every entry from 02282012_1 in the master table have a column with the original table name in it