日期:2014-05-17 浏览次数:21473 次
with
test as
(
select 1000 as id , 300 as mid from dual
union all
select 1000 as id , 200 as mid from dual
union all
select 1000 as id , 200 as mid from dual
),
test1 as
(
select rownum rn , a.* from test a
)
select a.id - b.mid as result from test1 a , test1 b where b.rn+1 = a.rn(+) order by a.rn
--运行结果
--------------------
700
800
null