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;
答案 0 :(得分: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
)
;
如果子查询返回多个结果,则需要将第一个"="
更改为"IN"
,或者相应地调整子查询(通过在row_number上过滤返回单行)。 / p>