更新奇数行记录

update t
set [field1] = 1
from (select ROW_NUMBER() OVER(ORDER BY [field2]) % 2 as odd_even, [field1]
      from table) as t
where odd_even = 1;

注:where odd_even = 0 为偶数行记录。

相关文章:

  • 2021-11-17
  • 2022-01-23
  • 2021-08-18
  • 2021-11-19
  • 2021-07-26
  • 2021-07-11
  • 2022-12-23
  • 2021-07-11
猜你喜欢
  • 2022-02-20
  • 2022-12-23
  • 2022-02-12
  • 2021-11-04
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案