weaver-hrm-salary/resource/sqlupgrade/Oracle/sql202406180403.sql

69 lines
2.3 KiB
SQL

update hrsa_salary_acct_emp a
set
(
department_id ,
department_name,
subcompany_id ,
subcompany_name,
jobtitle_id ,
jobtitle_name ,
jobcall_id,
jobcall,
status
)
=
(
select
b.departmentId,
b.departmentName,
b.subcompanyid,
b.subcompanyName,
b.jobtitleId,
b.jobtitleName,
b.jobcallId,
b.jobcall,
b.status from
(
select
e.id as employeeId,
d.departmentname as departmentName,
d.id as departmentId,
sc.SUBCOMPANYNAME as subcompanyName,
sc.id as subcompanyid,
c.jobtitlename as jobtitleName,
c.id as jobtitleId,
e.status as status,
e.jobcall as jobcallId,
job.name as jobcall
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
left join HrmSubCompany sc on e.SUBCOMPANYID1=sc.id
left join hrmjobcall job on e.jobcall=job.id
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
) b
where a.employee_id = b.employeeId
)
where a.delete_type=0 and
exists (select 1 from (
select
e.id as employeeId,
d.departmentname as departmentName,
d.id as departmentId,
sc.SUBCOMPANYNAME as subcompanyName,
sc.id as subcompanyid,
c.jobtitlename as jobtitleName,
c.id as jobtitleId,
e.status as status,
e.jobcall as jobcallId,
job.name as jobcall
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
left join HrmSubCompany sc on e.SUBCOMPANYID1=sc.id
left join hrmjobcall job on e.jobcall=job.id
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
) b
where a.employee_id = b.employeeId
)
/