UPDATE hrsa_salary_acct_emp
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_salary_acct_emp 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