weaver-hrm-salary/resource/sqlupgrade/SQLServer/sql202410090203.sql

31 lines
1.0 KiB
Transact-SQL

UPDATE hrsa_bill_detail
set department_id = b.departmentId,
department_name = b.departmentName,
subcompany_id = b.subcompanyid,
subcompany_name = b.subcompanyName,
jobtitle_id = b.jobtitleId,
jobtitle_name = b.jobtitleName,
jobcall_id = b.jobcallId,
jobcall = b.jobcall,
status = b.status
FROM hrsa_bill_detail a INNER JOIN (
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)
) as b
on a.employee_id = b.employeeId
WHERE a.delete_type=0
GO