update [MemberBackup].[dbo].[uid3times$]
set rc2tobedeleted =
case when rc1 > rc2 and rc1 > rc3 and rc2 < rc3 then rc2
when rc2 > rc3 and rc2 > rc1 and rc1 < rc3 then rc1
when rc3 > rc1 and rc3 > rc2 and rc1 < rc2 then rc1
else 0 end
我有3列RC1,RC2,RC3和号码3列是随机我想更新/设置在第二次数最多rc2tobedeleted
但我的代码来到其他地方,因为我认为我已经照顾了3种可能的情况。
我在做什么错了?
如果他们是4值而不是3呢? –
@ArijitMukherjee - 简单的将第四列添加到表值构造函数。像这样((VALUES(rc1),(rc2),(rc3),(rc4))' –
,如果我想要第三高,那么rn = 3或偏移2正确? –