2个表 A表 B表
update A set aa = aa + 1
where(select ba from B where bb= 0) = abA
aa int
ab int
B
bb int
ba int问题是select ba from B where bb= 0 返回多个值 而作为 A表的条件不行
爆的错:当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
update A set aa = aa + 1
where(select ba from B where bb= 0) = abA
aa int
ab int
B
bb int
ba int问题是select ba from B where bb= 0 返回多个值 而作为 A表的条件不行
爆的错:当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
update A set aa = aa + 1
where exists (select ba from B where bb= 0 and ba = A.ab)
From A
where exists (select ba from B where bb= 0 and ba = A.ab)
From A,B
where A.ab=B.ba and B.bb=0
where ba IN(select ba from B where bb= 0)
From A
where exists (select 1 from B where bb= 0 and ba = A.ab)