Hi, I need to select full span of employees under a Manager, say if X is the manager, and A, B, C report to X, where A is also a manager and D, E, F report to A, Now I need to write a sql which gets manager name as the input, If I enter X as the manager name it should show A, B, C, D, E, F in the output. Please let me know how to achieve this. If you have any Sql pls share it. I need to use this in an SQR.
| Title | Under | Posted on |
|---|---|---|
| MD5 - SHA checksum of a file. | PeopleSoft Technical | 02/07/2012 - 5:29am |
| nVision Tabular Report through PIA with prompts | PeopleSoft Technical | 02/02/2012 - 10:07pm |
| Can we create an AE to mass update Position - Jobcode data? | PeopleSoft Technical | 01/18/2012 - 3:11am |
| Pay Components on job data can be defaulted and setup based on the rules? | PeopleSoft Functional | 01/05/2012 - 4:58am |
If your database platform is oracle then you can use start with--connect by clause.
Here is sample SQL
SELECT emplid, supervisor_id
FROM ps_employees
START WITH supervisor_id = '1122456'
CONNECT BY PRIOR emplid = supervisor_id;
Regrads,
Rahul Khandelwal
here is a blog post that will explain what rahulkhandelw is talking about http://www.compshack.com/sql/start-with-and-connect-by-oracle-sql
Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
Thanks, this worked and its pretty simple to understand!!
How to use "connect by prior" to select value from Job table based on effective date or let me know how to give effective date condition in the above mentioned sql
Post new comment