1
update dkc_hsp_pi a
set a.UaID = (select uid from 
(
select uid,
emplid,
max(EFFDT) 
from sysadm.ps_ua_eds_data
group by uid,
emplid ) s)
where s.emplid = a.emplid;
4

1 回答 1

0

别名“s”在您使用它的地方无法访问:尝试将WHERE子句向上移动一个级别,如下所示:

update dkc_hsp_pi a
set a.UaID = 
(
select uid from 
  (
    select uid,
           emplid,
           max(EFFDT) 
    from sysadm.ps_ua_eds_data
    group by uid, emplid 
  ) s
  where s.emplid = a.emplid
)
;

如果您的子查询返回多个结果,则需要将第一个更改"="为 an ,或相应地调整子查询(通过在 row_number 上过滤返回单行)。"IN"

于 2013-05-24T18:28:30.697 回答