UPDATE VS4TInventoryLOT Set TIMCCostInputType=(SELECT TOP 1 1-0 FROM VS4TInventoryMB
WHERE (VS4TInventoryMB.TInMTInTAlias like 'RECEIVEFG%' OR VS4TInventoryMB.TInMTInTAlias like 'REPACK%' )
AND VS4TInventoryMB.TInMAmouQuantity>0
AND VS4TInventoryMB.TInMTPdtCode  = VS4TInventoryLOT.TIMCTPdtCode
AND VS4TInventoryMB.TInMLotNo  = VS4TInventoryLOT.TIMCLotNo
AND VS4TInventoryMB.TInMLotDate  = VS4TInventoryLOT.TIMCLotDate
AND VS4TInventoryMB.TInMSerialNo  = VS4TInventoryLOT.TIMCSerialNo
AND VS4TInventoryMB.TInMCustom1  = VS4TInventoryLOT.TIMCCustom1)
GO
UPDATE VS4TInventoryLOT Set TIMCCostInputType=0 WHERE TIMCCostInputType is Null
GO