我用select top 1 from xx where id>xx select top 1 from xx where id>xx得到该文章的上下篇但是不知道怎么在页面里做。
2 回答
慕哥6287543
TA贡献1831条经验 获得超10个赞
这条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;
- 2 回答
- 0 关注
- 528 浏览
添加回答
举报
0/150
提交
取消