oracle 上下行某字段相减

select
   a.active_time,b.active_time,(a.active_time - b.active_time),a.num,b.num
from
   (select row_number() over (order by t.create_time desc) num,t.* from YB_WC_MONITOR t) a,
   (select row_number() over (order by t1.create_time desc) num,t1.* from YB_WC_MONITOR t1) b
where
   a.num=b.num-1;

你可能感兴趣的:(oracle 上下行某字段相减)