try thisdeclare @table1 table(cardno varchar(32),wh1 decimal(18,2),wh2 decimal(18,2), wh3 decimal(18,2), wh4 decimal(18,2), poss decimal(18,2))insert into @table1 select 'a123', 2.00, 2.00, 1.00, 1.00, null union all select'a270', 10.50, 7.25, 3.10, 1.00 ,null union all select'b111', 3.00, 3.10, 1.00, 2.00,null union all select'b358', 11.00, 8.00, 2.00, 7.00,null union all select'c123', 3.50, 3.50, 1.00, 3.00,null declare @table2 table(cardno varchar(32),rsv decimal(18,2),openl decimal(18,2))insert into @table2 select 'b111', 1.00,2.00 union all select'a123', 1.15, 3.15 union all select'a270', 10.00, 1.00 union all select'b358', 0.00, 1.15 union all select'c123', 7.50, 3.00 union all select'd112', 1.00, 2.00update tset poss = (wh1+wh2+wh3+wh4)-(rsv+openl)from@table1 tinner join@table2 tt on tt.cardno = t.cardnoselect * from @table1