sql查询上一条记录和下一条记录

上一条记录的SQL语句:

select top 1 * from news where newsid<id order by newsid DESC

下一条记录的SQL语句:

select top 1 * from news where newsid>id order by newsid ASC

 开发中遇到需要在当前页面显示当前文章的上一篇文章和下一篇文章,百度了一下,搜索到以上SQL语句:

原文地址:https://www.cnblogs.com/print-true/p/5586869.html