INFO表里面有个SORT字段,是用来分类的 要想用top取得SORT='news'中的第11条到第15条数据该怎么写sql语句
------解决方案--------------------
- SQL code
select top 5 * from (select top 15 * from INFOwhere SORT='news') as a order by id desc--就是分页嘛
------解决方案--------------------
- SQL code
select * from (select ROW_NUMBER()over(order by getdate())rn,* from INFO where SORT='news')a where rn between 11 and 15
------解决方案--------------------
- SQL code
--不好意思上边表名写错了---不应该从时间上去取值的,应从id取select * from (select row_number() over(order by id)rn,* from intowhere sort='news')twhere rn between 11 and 15