您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

根据行中的值用值更新SQL行的最快方法是什么?

根据行中的值用值更新SQL行的最快方法是什么?

我猜您正在使用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;
SQLServer 2022/1/1 18:52:54 有471人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶