首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

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

2014-01-22 
菜鸟请教一个语句怎么写我的意图是update (tableA a left join tableB b on a.col1b.col1)set a.col2so

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

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

热点排行