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)
 SQL Help - Select only negative numbers

Author  Topic 

jrockfl
Posting Yak Master

223 Posts

Posted - 2005-03-22 : 19:35:43
How can select the records when InStock is negative?

SELECT Vend_No, Qty_On_Hand - Qty_Allocated AS InStock, Item_No
FROM IMINVLOC_SQL

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-22 : 19:37:18
SELECT Vend_No, Qty_On_Hand - Qty_Allocated AS InStock, Item_No
FROM IMINVLOC_SQL
WHERE Qty_On_Hand - Qty_Allocated < 0


...or, this one is better...

SELECT Vend_No, Qty_On_Hand - Qty_Allocated AS InStock, Item_No
FROM IMINVLOC_SQL
WHERE Qty_On_Hand < Qty_Allocated
Go to Top of Page

jrockfl
Posting Yak Master

223 Posts

Posted - 2005-03-22 : 19:38:34
I love this forum, you gurus are quick!
Thank you!
Go to Top of Page

SqlStar
Posting Yak Master

121 Posts

Posted - 2005-03-23 : 01:26:10
Thanks for your admiration about SQL Team...

:) While we stop to think, we often miss our opportunity :)
Go to Top of Page
   

- Advertisement -