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!

INNER JOIN???

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
JOINS, my Achilles heel

tblFoo
---------
FooID [int] | Foobar [varchar] | HasQuota [int] | Quota [int] | Stock [int]

How would I get all values from tblFoo based on a certain quantity value? If the record has a quota then I check to see that quantity <= stock, if the record has no quota then return it as part of the result set. Any help appreciated.
 
I'm not sure that you need a join for this. Where is the quantity value coming from?

Here is a guess (assumes 0 in HasQuota means there is not a quota):

Code:
select * from tblFoo
where HasQuota = 0
or quota < Stock

HOpe this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
where do you see a join coming into this?

why even have the HasQuota column? why not just let Quota be NULL?

and where is this Quantity coming from, which must be less than or equal to Stock?

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top