我用select top 1 from xx where id>xx select top 1 from xx where id>xx
得到该文章的上下篇
但是不知道怎么在页面里做。
海绵宝宝撒
浏览 529回答 2
2回答
慕哥6287543
这条sql语句可以得到两条相邻数据,然后分别显示这两条就ok了select * from Article where ([ID] = (select MAX([ID]) from Article where [ID]<当前文章ID号)or [ID] = (select MIN([ID]) from Article where [ID]>当前文章ID号 ))或者select top 1 * from Article where ID<当前文章ID号 order by ID desc;select top 1 * from Article where ID>当前文章ID号 order by ID asc;