怎么用SQL语句表示后一条记录减前一条记录

2024-11-08 19:30:54
推荐回答(2个)
回答1:

直接写就行了么,select 字段A-字段B from 表名

回答2:

select b.字段-a.字段 from
(select row_number() over (order by id) as row_id,* from 表名
)a,
(select row_number() over (order by id) as row_id,* from 表名
)b
where a.row_id+1=b.row_id