更新时间:2023-02-06 18:41:05
我将猜测您正在使用SQL Server.如果是这样,您可以在一个查询中完成所有操作:
I am going to guess that you are using SQL Server. If so, you can do this all in one query:
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;