はあなたが
0123を行きます
-- just sample of data from your question
with t1(Ename, Deptno, JoinDate) as(
select 'RAKESH', 10, to_date('01-OCT-90', 'dd-mon-rr') from dual union all
select 'RAKESH', 20, to_date('01-DEC-91', 'dd-mon-rr') from dual union all
select 'RAKESH', 30, to_date('01-MAR-92', 'dd-mon-rr') from dual
)
-- actual query
select ename
, deptno
, to_char(joindate, 'dd-mon-rr') as startdate
, nvl(to_char(jdate - 1, 'dd-mon-rr'), 'Still Working...') as enddate
, (nvl(jdate - 1, sysdate) - joindate) as working_days
from (
select ename
, deptno
, joindate
, lead(joindate, 1) over(partition by ename
order by joindate) as jdate
from t1 q)
結果:
ENAME DEPTNO STARTDATE ENDDATE WORKING_DAYS
------ ---------- ------------------ ------------------ ------------
RAKESH 10 01-oct-90 30-nov-91 425
RAKESH 20 01-dec-91 29-feb-92 90
RAKESH 30 01-mar-92 Still Working... 9343.50605
3 rows selected.
あなたは何を試みましたか? – OldProgrammer