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

Exclusionary outer join ?? 1

Status
Not open for further replies.

bassguy

Programmer
Jun 21, 2001
336
US
Hi all,
I am Trying to build a search Query that will search for a model number based on three parameters. I would like to output something like:

"These Models Meet 3 of your Criteria......data.......These models Meet 2 of your Criteria......data......These models meet 1 of your criteria"


I have the Stored Proc that will do this The only problem is When I display the Models That meet 2 of my criteria, I do Not want to Show the models that Contain 3 of the criteria and likewise, when I am showing models that meet one of the criteria I do not want to show the models that Have 2 or 3 Criteria met.

So I guess I am looking for a Type of join that will show me the out side ONLY of the left table (excluding where the left and right are equal)

any help would be appreciated

Tal McMahon





 

You can exclude records with an outer join, the "NOT IN" clause or the "NOT Exists" clause. Here are some examples.

Select table1.*
From table1 Left Outer Join table2
On table1.keycol=table2.keycol
Where table2.keycol Is Null

Select * From table1
Where keycol Not In
(Select keycol From table2)

Select * From table1
Where Not Exists
(Select * From table2
Where keycol=table1.keycol) Terry L. Broadbent
Life would be easier if I had the source code. -Anonymous
 
Thanks, never had to deal with "not exists" before kinda turns your head around thinking that way

Tal McMahon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top