select row_number() OVER(ORDER BY item_code ASC) xh,item_code from tableA
update tableA set xh=tempB.xh
from(select row_number()OVER(ORDERBY item_code ASC) xh,item_code from tableA where did='55') tempB
where tableA.item_code=tempB.item_code and did='55'
效果图:sql语句select row_number() OVER(ORDER BY item_code ASC) xh,item_code from tableAupdate tableA set xh=a.xhfrom (select row_number() OVER(ORDER BY item_code ASC) xh,item_code from tableA where did='55') tempBwhere tableA.item_code=tempB.item_code