|
Both the inventory quantity and inventory amount can be changed like this
update Kucun
set Kcsl = Kucun.Kcsl + RukuTmp.Rksl, Kcje = Kucun.Kcje + RukuTmp.Rkje
from Kucun, RukuTmp
where Kucun.ChID = RukuTmp.ChID
But what about the unit price of inventory?
The inventory unit price is obtained by dividing the inventory amount by the inventory quantity.
update Kucun set Kcdj = Kcje / Kcsl from Kucun, RukuTmp
where Kucun.ChID = RukuTmp.ChID and Kucun.Kcsl <> 0 (inventory quantity is not 0)
update Kucun set Kcdj = 0 from Kucun, RukuTmp
where Kucun.ChID = RukuTmp.ChID and Kucun.Kcsl = 0 (the stock quantity is 0) |
|