Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query Orders in stock ?

Author  Topic 

hug
Starting Member

11 Posts

Posted - 2001-04-01 : 03:53:50
Hello All,
I have three tables

orders
orderitem
product


orders.orderid
orderitem.orderid
orderitem.productid
product.productid
product.stock

i want find all the orders where all the items for that order are instock.
There can be more than one item in an order
and the stock is an integer which is the number in stock.

eg.

Orders
orderid
1
2
3
4

orderitem
orderid productid
1 2
1 3
2 1
2 2
3 1
3 3
4 2

product

productid stock
1 5
2 3
3 0


result of the query i cannot work out
would be Ordersid all items instock

orderid
2
4

Games Warehouse
http://www.gameswarehouse.com.au
Come to Games Warehouse for Australias best prices on computer and Video Games.
   

- Advertisement -