I don't know much about Access. Where do I put the Select clause? I opened
the query in design and added the two tables. I joined them by SSN &
Effective Date. Where do I enter the statement?
Hi,
since it is a UNION query, you have to do it in the SQL view, but you can
also do it in smaller steps, using the graphical environment for the more
problematic parts.
We will make 3 queries.
The first one, bring your two tables, join them as you did, but next, right
click on the line representation of the join and, from that context menu,
use option 2. Repeat for each line making the join. Bring the required
fields in the grid. Save that query, qu1.
The second query starts the same way, but this time, use option 3, for all
the lines of the join. Bring the same fields as for qu1 in the grid. If one
of the field with an arrow pointing to it (in the first table) is in the
grid, add the criteria: IS NULL. If no field with an arrow pointing to it
from the join is in the grid, bring one, uncheck the Show check box, and add
the criteria IS NULL under it. Save that query, qu2.
In the last query, you have to move into an SQL view. You can switch to the
SQL view from the first button on the default toolbar. The typing you have
to do is:
SELECT * FROM qu1
UNION
SELECT * FROM qu2
save it as qu3. Use qu3.
Just for sanity purpose, the first query could look like, in SQL view:
SELECT tableA.f1, tableB.f2
FROM tableA LEFT JOIN tableB ON tableA.SSN = tableB.SSN AND
tableA.EffectiveDate = tableB.EffectiveDate
the second query could look like, in SQL view:
SELECT tableA.f1, tableB.f2
FROM tableA RIGHT JOIN tableB ON tableA.SSN = tableB.SSN AND
tableA.EffectiveDate = tableB.EffectiveDate
WHERE tableA.SSN IS NULL
Hoping it may help,
Vanderghast, Access MVP
>I don't know much about Access. Where do I put the Select clause? I
>opened
[quoted text clipped - 47 lines]
>> > get 40408 records and they all have a match so I know I am not doing
>> > something correctly.