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.
Author |
Topic |
Pieter
Starting Member
5 Posts |
Posted - 2007-07-08 : 23:53:08
|
Dear guys,Sory for bad my english languages.I have a case in accounting like this belowResult 1:PartNo Qty InvDateA 2 16/03/2007A 2 17/03/2007A 5 18/03/2007If user pick PartNo A=3, so my t-sql want to need result like this below :Result 2:PartNo Qty InvDateA 2 16/03/2007A 1 17/03/2007Like that, I have a scenario FIFO method. First, pick from InvDate smaller date from other InvDate.I have a syntax sql to detected the result that ( result 2 ), but i'm still confusing when user pick other PartNo. If user want to pick PartNo=4, so the result should be like this :Result 3:Result 3:PartNo Qty InvDateA 1 17/03/2007 ==> Because in InvDate A still 1 Qty remaining ( 2-1 ) still 1A 3 18/03/2007 ==> Because in InvDate A still 5 Qty remaining ( 5-3 ) still 2And the scenario continues result. So, In InvDate=18/03/2007, A still have remaining Qty=2, because3 have been pick from result 3.So, in like that scenario, how i can implement this t-sql method?Please advise me.I have need more deep learning from this forums,This forum more good learning like me(beginner) ;-).need help you guys.Especially from Peso.Best Regards,PieterStarting Member |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|