This might do the trick allthough I haven't tested it yet:UPDATE user SET Balance = Balance - IsNull(dt1.SumAmount, 0) FROM (SELECT Currency AS MyCurrency, SUM(a.Amount) AS SumAmount FROM transcript a WITH (ROWLOCK) INNER JOIN user b WITH (ROWLOCK) ON a.UserID = b.UserID WHERE a.DescID = @DescID GROUP BY Currency) AS dt1WHERE Currency = dt1.MyCurrency
--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand"