oracle 上下行某字段相减
2020-10-20 本文已影响0人
平面小狮子
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;