我想更新表b的数据,但是要表a的第一列的值是2,我才要更新表b第3列的内容
我要怎样用sql表达呢?inner join 也不行,我不是要连接两个表,只是按照要是表a的内容要是某个数值,我才去更新表b的内容
求大神谢谢
第1个回答 2016-10-11
update b set b.[第3列]=a.[第1列] from a,b where a.id = b.id and a.[第1列]=2
第2个回答 2016-10-11
update b
set columns ='******'
where b.*** in (
select ***
from a
where column1 = 2
)追问
set columns ='******'
where b.*** in (
select ***
from a
where column1 = 2
)追问
这样的subquery可以让这条件成?
追答subquery 就是为了让你找出b表中符合的数据。a表和b表是根据***关联。并且a表中colunm1等于2
本回答被网友采纳