请问有谁知道sql数据库中的update table set data_01(字段名 )= select ...多个条件 
  多行赋给一个字段,再根据条件update 。在oracle中该怎样实现??

解决方案 »

  1.   

    update t1 set data01 = (select t2.data01 
                               from t1,t2
                                where t1.id = t2.id)
    where t1 --加上条件
    或update ( t1.data01 as d1 ,t2.data01  as d2
               from t1 ,t2,
                where t1.id = t2.id  -- 两个 id至少有一个主键)
    set d1 = d2;
      

  2.   


     你好,如果是只有在一个表里操作呢?比如 :(select data02 froom t2 where year = '2004' and month = '03')返回多行,然后
      update t1 set data01 = (select data02 froom t2 where year = '2004' and month = '03') where ...;
      

  3.   

    你这样查询 select data02 froom t2 where year = '2004' and month = '03'如果 返回多行,语法上就错了
      

  4.   

    借用fuyou001 
    [code=SQL]
    update t1 set data01 = (select t2.data01 
                              from t1,t2 
                                where t1.id = t2.id ) --找出两表关联关系
    where t1 --加上条件 
    [code]