日期:2014-05-16  浏览次数:20810 次

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

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);