还有,怎样在oracle中正确更新呢?请指教。

解决方案 »

  1.   

    Update Table1 Set Table1.Car=(select max(Table2.car) from Table2 where  Table1.Name=Table2.Name)
    where 
    exists(select Table2.car from Table2 where  Table1.Name=Table2.Name) and 
    Table1.Name in (Select Name from Table2  Group by Name Having Count(Car)=1);
      

  2.   

    ▲修改表1中的某列,目标值需要到表2中查询update tb_wap_pijia2 /*添加IMSI号*/
    set imsi=( select imsi from tb_mdn2imsi
    where mdn=tb_wap_pijia2.mdn )
    where exists (select mdn from tb_mdn2imsi 
    where mdn=tb_wap_pijia2.mdn) /*WHERE的目的是为了避免插入空值*/
      

  3.   


    update tb_wap_pijia2  set imsi=( select imsi from tb_mdn2imsi
    where mdn=tb_wap_pijia2.mdn )
    where exists (select 1 from tb_mdn2imsi 
    where mdn=tb_wap_pijia2.mdn)
      

  4.   

    update table1 a set  a.car = 
        (select car from table2  where (name,1) in
                       (select b.name,count(1) from table2 b 
                            where a.name = b.name
                             group by name))
    这个好象也行哇
      

  5.   

    楼主:你的SQL语法就有问题啊,having 一般要放在group by之前的