我猜您正在使用SQL Server。如果是这样,您可以在一个查询中完成所有操作:
with toupdate as ( select p.*, row_number() over (partition by fkProductID order by pkProduct) as new_intIssue from dbo.tblProducts p )update toupdate set intIssue = new_intIssue where intIssue <> new_intIssue;



