Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to query out rows 2 or 3 place back

User_I35Y8Dec 9 2022

Hello ,
Pls I need help with a project I am working on to get audit report . we have employee history table ( emp_id_emp_status_home_orgn_code etc) and jobs table ( emp_id ,job_title ,job_beg_date, job_end_date, job_effect_date..etc) . looking for prior home_orgn_code ,job active status ,active job title ,emp_id .
key point : Home orgn account : i.e Chart acc 2 ,replaced by Chart account M because of that two of Home_orgn codes are default e.g H1H2 and 7897 (replaced by H1H2 default value ,not suppose be exist too). based on the chart Acct update , H1H2 and 7897 shouldnot be there so Audit needed for these emp with H1H2 and 7897 and most recent home_orgn code needed in this report .
Now , looking for Chart_acc = M , Home_orgn = H1H2, emp_id ,job_title , Job_status < T (not terminated ) .
image.pngHow can I pulled that above date, I am trying LEG/LEAD functions but not working .Please assist .Thanks

Comments
Post Details
Added on Dec 9 2022
1 comment
164 views