读书人

初学者请问一个语句如何写

发布时间: 2014-01-22 00:03:39 作者: rapoo

菜鸟请教一个语句怎么写
我的意图是

update (tableA a left join tableB b on a.col1=b.col1)

set a.col2='somthing1' where b.col2='something2'

写法当然不是这样 但是大概是这个意思
求高手指导。
[解决办法]
update tableA a set a.col2='somthing1'
where a.col1 in (select b.col1 from tableB b where b.col2='something2')
[解决办法]

update tableA a
set a.col2 = 'something1'
where exists (select 1
from tableB b
where b.col2 = 'something2'
and b.col2 = a.col1);

读书人网 >oracle

热点推荐