试试: 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');
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')
谢谢,上面的方法很管用。 请再看看,若把'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'));上面这段提示错误
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')
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');
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')
请再看看,若把'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'));上面这段提示错误
(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')
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 中怎实现?