I need to select all the employees under a manager in a particular span of time period. Say I need to select full span of employees who were under "12345" between 01/JAN/2009 to 07/MAR/2009. Employees who were under "12345" only till 05/JAN/2009 and got shifted to another department should also get listed in the output and same case for terminated employee. I am using the below SQL, but its not fetching correct employee. Pls let me know how to achive this.
Select a.emplid, a.supervisor_id from PS_job a
START WITH a.supervisor_id = '12345'
CONNECT BY PRIOR a.emplid = a.supervisor_id
and a.empl_status in ('A','L','P','S')
and a.effdt = ( (Select Max(Effdt) from
ps_job where emplid = a.emplid
and empl_rcd = a.empl_rcd and effdt <= 07/MAR/2009)
or a.effdt = (Select Max(Effdt) from ps_job
where emplid = a.emplid and empl_rcd = a.empl_rcd
and (effdt >= 01/JAN/2009 and effdt <= 07/MAR/2009)
and a.empl_status in ('A','L','P','S')))
Title | Under | Posted on |
---|---|---|
Component interface Error: no rows exist for the specified keys | PeopleSoft Technical | 03/15/2019 - 3:54am |
ADD 24 months starting from current month.(peoplesoft) | PeopleSoft Functional | 07/29/2018 - 8:44pm |
TRC values dropdown | PeopleSoft Technical | 04/04/2018 - 12:54am |
how to find missing sequence in GRID and print the mising sequence number while saving through peoplecode | PeopleSoft Technical | 09/11/2017 - 4:49am |
Try the below for your dates:
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
There is no problem with the date format, its issue with the logic, bcoz its not fetching the correct employees
Pls let me know how to give effective date and other conditions, while using "connect by prior" in a sql.