Comparing id s of same column and assign value of one to another
WITH cte AS (SELECT *, 
                    MIN(name) OVER (PARTITION BY id 
                                    ORDER BY name ASC) rn 
             FROM test)
UPDATE cte 
SET name=rn


fiddle

This will work on the basis of the "lower" letters (IE 'A') will overwrite "higher" letters (IE 'B'), as you have not indicated any preference for how to handle this ordering.