求表中相邻的两条记录的某字段的值之差
select a.v1-b.v1
from (select id,v1 from t2 where id>1) a,
(select id,v1 from t2 where id<>(select max(id) from t2)) b
where a.id=b.id+1
求表中相邻的两条记录的某字段的值之差
select a.v1-b.v1
from (select id,v1 from t2 where id>1) a,
(select id,v1 from t2 where id<>(select max(id) from t2)) b
where a.id=b.id+1