1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| With MaTable AS
(
select trunc(sysdate) as dt, 'm0' as mt from dual union all
select trunc(sysdate) + 1 , 'm1' from dual union all
select trunc(sysdate) + 2 , 'm2' from dual union all
select trunc(sysdate) + 3 , 'm3' from dual union all
select trunc(sysdate) + 4 , 'm4' from dual
)
select dt, mt,
lead(dt) over(order by dt asc) as dt_plus_un,
lead(mt) over(order by dt asc) as mt_plus_un
from MaTable;
DT MT DT_PLUS_UN MT_PLUS_UN
08/01/2010 m0 09/01/2010 m1
09/01/2010 m1 10/01/2010 m2
10/01/2010 m2 11/01/2010 m3
11/01/2010 m3 12/01/2010 m4
12/01/2010 m4 |
Partager