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!

Select results that are not in both tables.

Status
Not open for further replies.

nminaker

Technical User
Jun 17, 2004
19
0
0
I have two tables: One master list of all the items that a user can select and a list of the items the user has selected.

When I load the master list I want to select only the items that don't exist in the user list.

Thanks!

Nick
 
Perhaps something like:
[tt]
SELECT item FROM masterlist
WHERE item NOT IN (SELECT item FROM userlist)[/tt]
 
Another way:
SELECT M.item
FROM masterlist M LEFT JOIN userlist U ON M.item = U.item
WHERE U.item IS NULL

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks! Works great. I guess I need to work on my sql skills a little. :) It seems so simple now...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top