문제

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;
도움이 되었습니까?

해결책

The alias "s" is unreachable from the place where you use it: try moving the WHERE clause up a level like this:

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
)
;

you'll need to change the first "=" to an "IN" if your subquery returns more than one result, or adjust the subquery accordingly (by returning a single row by filtering on row_number).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top