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

Unmatched Query based on combo of two fields 1

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I need to create a query that compares two fields in each of two tables, and determines which records in TableA do not exist in TableB based on the combination of those two fields. The Find Unmatched Query Wizard only allows you to compare single fields, so I'm not sure how to do this.

The tables are ActBud and CACworkCenters. The two fields to use are JobNumber and WorkCenter. for each JobNumber, there can be many WorkCenters, and vice-versa.

I need to import each JobNumber/WorkCenter combination from ActBud into CACworkCenters only if that combination is not already present in CACworkCenters. How can I write the SELECT section of the INSERT query to accomplish this?

Cheryl dc Kern
 
Have you tried this ?:
SELECT A.*
FROM ActBud A LEFT JOIN CACworkCenters C ON A.JobNumber = C.JobNumber AND A.WorkCenters = C.WorkCenters
WHERE C.JobNumber Is Null

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That got it, thanks!

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top