You can put Jim's query into a subquery or cte and then do the update. First run this query to make sure that you are getting the results you want.;with cte as( select name,Age, [count],ROW_NUMBER() over(partition by name order by age) -1 AS newCount from yourtable)SELECT * FROM cte;
If the newCount column looks like it has the correct values, then run this query to do the update:;with cte as( select name,Age, [count],ROW_NUMBER() over(partition by name order by age) -1 AS newCount from yourtable)UPDATE cte SET [count] = newCount;