oracle 查询当前记录的上一条记录或下一条记录

前端之家收集整理的这篇文章主要介绍了oracle 查询当前记录的上一条记录或下一条记录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

上一条

select *

from cms_article a
where id = (select c.p
from (select t.id,lag(t.id,1,0) over(order by t.sort) as p
from cms_article t) c
where c.id = '8a3e56b6396630260139663fa32d01e1');


下一条


select a.id,a.title
from cms_article a
where id = (select c.p
from (select t.id,lead(t.id,0) over(order by t.sort,t.eidt_date) as p
from cms_article t ) c
where c.id = '8a3e56b6396630260139663fa32d01e1');

猜你在找的Oracle相关文章