Select first instance of a product having negative in stock quantity

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 3
Reputation: stewpyd is an unknown quantity at this point 
Solved Threads: 0
stewpyd stewpyd is offline Offline
Newbie Poster

Select first instance of a product having negative in stock quantity

 
0
  #1
Aug 7th, 2008
Hi,

I want to select the part no(part_no), transaction date (curr_date), and in stock qty (cost_layer_qty) from table inv_tran where the product first goes into negative quantity.

Do I use a group by for curr_date, or how do I do this?

Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Select first instance of a product having negative in stock quantity

 
0
  #2
Aug 15th, 2008
Hi,

I don't know if I got u but try:

SELECT TOP 1 part_no, curr_date, cost_layer_qty
FROM inv_tran
WHERE (cost_layer_qty < 0)
ORDER BY cost_layer_qty DESC


Hope this works for you.
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the MS SQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC