获取第21~25条记录,sql怎么实现 ?
rt,获取数据库中排第21至25的记录,
数据是按id升序排列的,当id不连续的,
sql语句怎么实现 ?
------解决方案--------------------select * from 表名 where id betwen 21 and 25 好象是这样的,呵呵
------解决方案--------------------select top 5 * from table where id not in (select top 20 id from table)
------解决方案--------------------建个临时表就可以解决了
------解决方案--------------------或者用游标
------解决方案--------------------select top 5 a.* from (select top 25 * from t1 order by id) a order by a.id desc
------解决方案--------------------select top 5 a.* from (select top 25 * from t1 order by id desc)
会更好些
------解决方案--------------------支持
select top 5 * from table where id not in (select top 20 id from table)
------解决方案--------------------都说完了 没得说
------解决方案--------------------select top 5 a.* from (select top 25 * from t1 order by id desc)
会更好些
——————————————————————————————————————
兄弟没搞错吧,你那样取到后面去了
------解决方案--------------------顶