View Full Version : Query from two tables


popen
10-01-2001, 03:02 AM
I will try to keep this as brief as possible.
This involves two tables, say, table 1 and table 2. Both tables are identical in design and fields, but when a date is entered in a specific field in table 1, append and delete queries are run to copy the record over to table 2 and delete it from table 1.
I guess you could call table 1 'live data', and table two 'archive'.
OK, now this is the tricky part;
What I need to achieve is to design a query that calculates a simple 'DateDiff' calculation against two fields. No problem there. The problem lies where I need this calculation run against the fields on BOTH tables, to look at historic data aswell as current to get a total from, say, the past six months to present.
I can get the query to provide the information off one table, but is it possible to get both the tables together on one query ?

Any help out there?

-NEIL

KDg
10-01-2001, 03:39 AM
if the tables have identical fields you should be able to do a UNION query to get them together. Depending on how complicated the single queries are you may need/want to do 2 seperate queries and then pull it together into one

HTH

Drew

popen
10-01-2001, 05:14 AM
Excellent ! Many thanks. I used 'UNION ALL' statement and I achieved the results I was after.

Regards,

-NEIL