前一条 后一条 首条 尾条 的sql语句怎么写呀。。。
如题
------解决方案--------------------加入ID是重从大到小的顺序
前一条
select top 1 * from table where id < '当前ID ' order by id desc
后一条
select top 1 * from table where id> '当前ID ' order by id
首条
select top 1 * from table order by id
尾条
select top 1 * from table order by id desc