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

One query?

Status
Not open for further replies.

tsp1lrk72

IS-IT--Management
Feb 25, 2008
100
US
How can i put this into one query?

Code:
Select  *
From	tblVendorInfo 
where	RankComplete IS NOT NULL AND DivisionName = 'BP'
Order by RankComplete

Select  *
From	tblVendorInfo 
where	RankInProgress IS NOT NULL AND DivisionName = 'BP'
Order by RankInProgress

Select  *
From	tblVendorInfo 
where	RankProblem IS NOT NULL AND DivisionName = 'BP'
Order by RankProblem

When I use AND for each one it shows nothing, example:

Code:
Select  *
From	tblVendorInfo 
where	RankComplete IS NOT NULL AND RankInProgress IS NOT NULL AND DivisionName = 'BP'
Order by RankComplete

Subquery?
 
Probably.... OR. Like this...

Code:
Select  *
From    tblVendorInfo
where   DivisionName = 'BP'
        And (RankComplete IS NOT NULL OR RankInProgress IS NOT NULL)
Order by RankComplete

The parenthesis are important.



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top