koresnordic
IS-IT--Management
I have a small table that contains a list of upcoming sales orders and purchase orders. It also contains a "start" value (which is the current stock). I have generated a query that puts the transactions into item & date order. An example of the data is:
item date qty ref
9417402 01-Jan-01 83.00 START
9417402 26-Apr-05 -10.00 CO 504305
9417402 20-May-05 -100.00 CO 503954
9417402 06-Jun-05 400.00 P530303
So following the course of events, this product would go negative on the 20th of May. What I need is to record the date the stock goes negative in another table (which consists of just the item and date negative). It may never go negative or it may go negative, get stock in so go positive, then go negative again - in which case it is the first date it goes negative we need. Is this possible or am I asking too much? I know some of you like a challenge, so I hope you enjoy this one.
![[pc] [pc] [pc]](/data/assets/smilies/pc.gif)
Graham
item date qty ref
9417402 01-Jan-01 83.00 START
9417402 26-Apr-05 -10.00 CO 504305
9417402 20-May-05 -100.00 CO 503954
9417402 06-Jun-05 400.00 P530303
So following the course of events, this product would go negative on the 20th of May. What I need is to record the date the stock goes negative in another table (which consists of just the item and date negative). It may never go negative or it may go negative, get stock in so go positive, then go negative again - in which case it is the first date it goes negative we need. Is this possible or am I asking too much? I know some of you like a challenge, so I hope you enjoy this one.
![[pc] [pc] [pc]](/data/assets/smilies/pc.gif)
Graham