UPDATE VS4TInventoryLOT SET TIMCTInTAlias=(SELECT TOP 1  TINMTINTAlias FROM VS4TinventoryMB 
 WHERE VS4TinventoryLOT.TIMCTPdtCode=VS4TinventoryMB.TInMTPdtCode
 AND VS4TinventoryLOT.TIMCLotNo =VS4TinventoryMB.TInMLotNo 
 AND VS4TinventoryLOT.TIMCLotDate=VS4TinventoryMB.TInMLotDate 
 AND VS4TinventoryLOT.TIMCCustom1 =VS4TinventoryMB.TInMCustom1 
 AND VS4TinventoryLOT.TIMCSerialNo =VS4TinventoryMB.TInMSerialNo
 AND VS4TinventoryMB.TInMAmouQuantity>0
 AND VS4TinventoryMB.TInMTInTAlias in ('LOTIN','LOTINPOP','LOTINPR','RECEIVEBUILT','RECEIVEBUILTOUT','REPACK','ADJUST','BEGINBALANCE')
 )
 WHERE TIMCTInTAlias='' or TIMCTInTAlias is null
GO

UPDATE VS4TInventoryLOT SET TIMCcostinputtype=1 where TIMCTInTAlias='REPACK'
GO