我有3张桌子: 可调节的 决赛桌 ptable
如果finaltable中的ID存在于regtable中,我想用REGtable中的QTRcontractend字段来更新finaltable中的QTRcontractend字段
我编写了下面的代码,但收到错误消息,表明我的子查询返回了多个值。如何仅选择一个值
update a
set QTRofcontractend = case when a.ID in (select ID from Regtable) then
(select contractendQTR from Regtable as org where ID = org.ID)
when a.ID in (select ID from ptable) then '0'
when a.ID in (select ID from Regtable) then '0'
else '--' end
from finaltable as a
感谢和问候, 尼桑思·巴斯卡兰(Nishanth Baskaran)