UPDATE Table1
set SomeColumn = X.SomeOtherColumn
from Table1 T1
cross apply
(select top 1 SomeOtherColumn from Table2 T2 where T2.SomeJoinColumn = T1.SomeJoinColumn order by CounterColumn) as X
I want to increase CounterColumn by 1 each time the cross apply query runs. Is there any way I could achieve this?