update一个表中的一个字段,但是需要从另外一个表中取数据。  
比如: 
update  tableA,tableB  
set  a.X=1        (x为一个字段)  
where  a.Y=b.Y     (y为一个字段,tableA和tableB中都有这个字段。)  这个语句对马?请指点。多谢了。

解决方案 »

  1.   

    update tablea a set a.x=1 where exists(select 1 from tableb b where a.y=b.y)
      

  2.   

    update tableA a set a.X=1 
    where exists(select 1 from tableB b where a.Y=b.Y)
      

  3.   


    update measure
    set measure.sent=1 
    where exists(select 1 from dptitem  where measure.dptcd=dptitem.dptcd)在运行pl/sql中的command窗口运行不了!
      

  4.   

    update tableB b set b.X=1 
    where exists(select 1 from tableB b where a.Y=b.Y)
    后面的条件可能要变化