Hi,
For below example table: -
say you had 4 units of product "a" in stock. how could you minus the stock sequentially from each record until it had been used up? so for example you minus 4 from the quantity of order 1, then order 1 would then have a qty of 0, or the record would be removed, then the remaining 1 stock would then be substracted from order 2, leaving order 2 with 1 quantity remaining.
Basically i want to know how much i need to make of each product on each day, but if i already have it in stock, i know i wont need to make some of the orders so grouping by product and then subtracting isnt a option.
thanks in advance
For below example table: -
order | product | quantity | date |
1 | a | 3 | 01/01/1111 |
2 | a | 2 | 02/01/1111 |
3 | b | 1 | 01/01/1111 |
say you had 4 units of product "a" in stock. how could you minus the stock sequentially from each record until it had been used up? so for example you minus 4 from the quantity of order 1, then order 1 would then have a qty of 0, or the record would be removed, then the remaining 1 stock would then be substracted from order 2, leaving order 2 with 1 quantity remaining.
Basically i want to know how much i need to make of each product on each day, but if i already have it in stock, i know i wont need to make some of the orders so grouping by product and then subtracting isnt a option.
thanks in advance