update vs4tinventorymb SET TInMTLctcode=(select tpssmaintlctcode from vs4tproductsafes where tpsstbracode=(select tinvfromtbracode from vs4tinventory where tinmtinvno=tinvno) and tpsstpdtcode=tinmtpdtcode) where tinmtintalias='RECEIVEBORROW'  and tinmamouQuantity>0 
update vs4tinventorymb SET TInMTLctcode='BORROW' where tinmtintalias='RECEIVEBORROW'  and tinmamouQuantity<0 