Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

joining two tables based on uniqueness

Status
Not open for further replies.

drStealth

Programmer
Dec 26, 2001
22
US
Hello all, this looks simple enough but we're having some difficulty in solving it:

We have two tables with sample values as follows:

Table1 Table2

A A
B B
C Y
D Z

We'd like to join these to create a result set that would show the following:

Result:
C
D
Y
Z

In other words, we want a result set with only those values that are unique in each table. Any ideas on how to do this in Access 2000? Thanks to all. drStealth
 
You need a UNION query:

SELECT field1
FROM Table1
WHERE field1 not in (select field1 from table2)
UNION
SELECT field1
FROM Table2
WHERE field1 not in (select field1 from table1)
; Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Terry, thanks for your response, a similar structure seems to have done the trick. drStealth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top