这个在sql server ,sybase 下是允许的

解决方案 »

  1.   

    试试:
    update auc.auc_cur_groups a
           set status = 'OK'        
           where auc.auc_staff_hid_reg.clienthid = clienthids and 
               auc.auc_staff_hid_reg .staffid = '*' and
               a.groupid = auc.auc_staff_hid_reg.groupid and 
               auc.auc_staff_hid_reg.activetime < currenttimes and
               auc.auc_staff_hid_reg.expiretime > currenttimes and
              (auc.auc_staff_hid_reg.status = 'OK' or auc.auc_staff_hid_reg.status = 'ACTIVE');
      

  2.   

    update auc.auc_cur_groups a set a.status='OK'
     where exits (select b.clienthid from auc.auc_staff_hid_reg b
                  where b.clienthid = clienthids 
                        and b.staffid='*' 
                        and a.groupid=b.groupid 
                        and b.activetime < currenttimes 
                        and b.expiretime > currenttimes 
                        and (b.status='OK' or b.status='ACTIVE')
      

  3.   

    谢谢,上面的方法很管用。
    请再看看,若把'OK'换成另一个表的某个字段值,该如何改呢?
    update auc.auc_cur_groups a
           set status = auc.auc_staff_hid_reg.status  
        where exists (select b.clienthid from auc.auc_staff_hid_reg b
         where b.clienthid = clienthids and b.staffid = '*' and
               a.groupid = b.groupid and b.activetime < currenttimes and
               b.expiretime > currenttimes and
               (b.status <> 'OK' and b.status <> 'ACTIVE'));上面这段提示错误
      

  4.   

    update auc.auc_cur_groups a set a.status = 
      (select b.status from auc.auc_staff_hid_reg b
        where b.clienthid = clienthids and b.staffid = '*'
              and a.groupid = b.groupid
              and b.activetime < currenttimes 
              and b.expiretime > currenttimes
              and (b.status <> 'OK' and b.status <> 'ACTIME')
      

  5.   

    这里有个问题要注意:如果嵌套的sql返回的记录不止一条的话,会出错.也就是对表auc_cur_groups的每条记录在修改的时候嵌套的sql语句只能返回一条.这个很容易理解.
      

  6.   

    初学 ORACLE 有很多地方不明白,请教个问题:
    TableA 表的字段: Num Number(5),Name VarChar(20)TableB 表的字段: Num Number(5),Name VarChar(20),IsOld Number(1) Default 0用 SQL 2000 的描述方法是:
    Update B 
        set B.Name = A.Name,B.IsOld = 0
       from TableA A,TableB B 
         where A.Num = B.Num and B.IsOld = 1;
    在 ORACLE 中怎实现?