BostonBullodu Posted October 4, 2017 Report Share Posted October 4, 2017 4 minutes ago, former said: Try with Analytic functions and check sample below one: Query with a RANGE windowing clause that uses the BETWEEN and FOLLOWING parameters SQL> select last_name, first_name, department_id, hire_date, salary, 2 SUM (salary) 3 OVER (PARTITION BY department_id ORDER BY hire_date 4 RANGE BETWEEN 365 PRECEDING AND 365 FOLLOWING) department_total 5 from employee 6 order by department_id, hire_date; LAST_NAME FIRST_NAME DEPARTMENT_ID HIRE_DATE SALARY DEPARTMENT_TOTAL ————————— ———————————— ————————————————— —————————— ———————— ———————————————— Eckhardt Emily 10 07-JUL-04 100000 100000 Newton Donald 10 24-SEP-06 80000 270000 James Betsy 10 16-MAY-07 60000 270000 Friedli Roger 10 16-MAY-07 60000 270000 Michaels Matthew 10 16-MAY-07 70000 270000 Dovichi Lori 10 07-JUL-11 peterson michael 20 03-NOV-08 90000 155000 leblanc mark 20 06-MAR-09 65000 155000 Jeffrey Thomas 30 27-FEB-10 300000 370000 Wong Theresa 30 27-FEB-10 70000 370000 Newton Frances 14-SEP-05 75000 75000 not sure if its the same with PL/SQL.. Quote Link to comment Share on other sites More sharing options...
vikuba Posted October 4, 2017 Report Share Posted October 4, 2017 so oka table same id tho multiple records untaye..but they will have difference post dates...correct aa? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.