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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing tables...

Status
Not open for further replies.

nateobot

Programmer
Jul 11, 2002
11
0
0
US
I have two fields in table1 called CompID and ElementID.

I have the same to fields in another table (table2).

How can I find out which records in table1 are not in table2. Both the compID and ElementID are the Primary Keys in each table.

Sounds simple enough but for some stupid reason I cannot get it to work.


Thanks
-Nate
 
Nate,
go to the "new query" tab and choose "find unmatched query wizard" and follow the directions.
jim
 
Thanks that was the first thing i tried. However the unmatched query only allows you to select one matching field in the two tables. I need to find the records where the two fields are not in the tables.

EX:

table1
CompID ElementID
26035 01454
26035 01467
26035 01455
26071 01454
26071 01455


table2
CompID ElementID
26035 01454
26035 01467
26071 01454
26071 01455



I need to know that record #3 in table1 is not included in table2.

Thanks
 
Try this:
1.) Use the wizard to design a query that finds unmatched records based on one field, say CompId
2.) Open the query in design mode
3.) Create a new join for the other column (click on ElementId in one table and drag a link to the ElementId column in the second table)
4.) Highlight the link (will make it look bold)
5.) Right click the link and select "Join Properties"
6.) Select the join properties that will perform as needed

You should then have a design view that has the two joins, with one side of the join link having an arrow. The arrows should be in the same direction.

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top