19 May 2020 by Maciej Los
Try this: DECLARE @customer TABLE(Customer VARCHAR(50), account int, [rank] int) INSERT INTO @customer (Customer, account, [rank]) VALUES('a',1,0), ('b',2,1), ('a',3,3), ('a',4,2), ('c',5,0) UPDATE t1 SET [rank] = t2.MaxRank FROM @Customer t1...