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

Select From Two Tables

Status
Not open for further replies.

JSOasis

Programmer
Sep 26, 2006
8
US
If a row exists in one table I want to exclude it from query on another table. For example if ID 32 exists in table A I do not want it to show in a query on table B with the same ID. Does any one know hoe to do this?
 
What links the two tables?

All you need to do is something like:
Code:
SELECT columns
FROM tableb
WHERE id NOT IN (SELECT ID FROM tablea)

-SQLBill

Posting advice: FAQ481-4875
 
Ignore the question. I was going to give another answer using joined tables and realized that wasn't needed, but I forgot to remove the question.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top