joining two tables question

F

Frank

Hi,

I have two tables that are sorted by date. I would to create a query that
joins both tables in such a way that I get a list of all dates (distinct)
from whatever table. Is there other keyword that INNER, LEFT or RIGHT JOIN?
thanks.

Frank
 
J

John Vinson

Hi,

I have two tables that are sorted by date. I would to create a query that
joins both tables in such a way that I get a list of all dates (distinct)
from whatever table. Is there other keyword that INNER, LEFT or RIGHT JOIN?
thanks.

Frank

Yes: UNION.

It sounds like you want to take TableA with 1000 records, and TableB
with 1200 records, and get a recordset with 1100 records, one for each
distinct date in the two tables... right?

If so, you need to go to the SQL window (you can't do it in the grid)
and type

SELECT datefield FROM tableA
UNION
SELECT datefield FROM tableB;

The UNION operator automatically removes duplicates for the selected
fields; there is a UNION ALL operator which preserves the dups.

John W. Vinson[MVP]
 
Top