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

Query to show what is not in a table 1

Status
Not open for further replies.

oticonaus

Technical User
Dec 16, 2003
96
AU
I have two tables, Salespeople and WorkingData. Both have a SPCode field. I want a query to tell me the records in WorkingData that are not in Salespeople. So the result from the data belwo would be JE, SW

Salespeople.SPCode
AB
DK

WorkingData.SPCode
AB
DK
JE
SW

I was thinking of doing a Dlookup on every record and then testing the result, but I am 98% sure there is a MUCH better way?
 
Use the Find Unmatched Query Wizard.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
oticonaus,

Or you could use the SQL NOT IN statement ie

Select SPCode from WorkingData
Where SPCode NOT IN (Select SPCode from Salespeople)

Mordja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top