日期:2014-05-17 浏览次数:20779 次
with t1 as
(
select 1 c1 from dual union all
select 2 c1 from dual union all
select 3 c1 from dual union all
select 4 c1 from dual union all
select 6 c1 from dual
)
select c1,c1-lag(c1) over(order by c1) c2
from t1
c1 c2
---------------------------
1 1
2 2 1
3 3 1
4 4 1
5 6 2