For more information, please refer to this announcement explaining best practices for getting answers to questions.
SQL Script for Worker's department
Content
Hi All,
I am trying to get the worker's department along with his name, person number, manager etc. I use the following script to get the department;
SELECT DISTINCT pd.NAME
FROM per_all_assignments_f po,
hr_all_organization_units pd
WHERE 1 = 1
AND po.person_id = a.worker_id
AND po.assignment_id = a.assignment_id
AND po.organization_id = pd.organization_id
AND po.business_group_id = pd.business_group_id
AND ROWNUM = 1
But this way it returns the department when the employee was assigned very first. Never returns employee's current department. I wonder why it has been so hard to query an employee's department.