上一条记录下一条记录

来源:互联网 发布:excelvba抓取网页数据 编辑:程序博客网 时间:2024/04/29 01:02

select top 1 * from 表 where id>当前id order by id desc
select top 1 * from 表 where id<当前id order by id desc

 

//上一条记录

select top 1 blogId from GCC_blogInfo 
where [blogId] < @blogId and [userId] = @userId and isSketch = 2 order by creatTime desc

 

//下一条记录

select top 1 blogId from GCC_blogInfo 
where [blogId] > @blogId and [userId] = @userId and isSketch = 2 order by creatTime desc

原创粉丝点击