sql server中如何取从第二条开始往后的N条记录?

netstu 2005-12-15 03:36:37
在mysql中是select * from tables limit 2,n;

SQL SERVER没玩过.
...全文
450 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
netstu 2005-12-15
  • 打赏
  • 举报
回复
我再试一下
  • 打赏
  • 举报
回复
写错了一个select
正确的如下
select top n * from tables where (id not in (select top 1 id from tables order by id )) order by id
  • 打赏
  • 举报
回复
select top n * from tables where (id not in (selet top 1 id from tables order by id )) order by id
netstu 2005-12-15
  • 打赏
  • 举报
回复
现在出现的内容还是select top 3 * from news_purpose where int(maoa)=1 order by newsdate desc,id desc的结果
netstu 2005-12-15
  • 打赏
  • 举报
回复
还是不行
chinastorm 2005-12-15
  • 打赏
  • 举报
回复
sqlpic="select top 3 * from news_purpose where int(maoa)=1 and id<>(select top 1 [id] from news_purpose where int(maoa)=1) order by newsdate desc,id desc"
这样行不?
netstu 2005-12-15
  • 打赏
  • 举报
回复
sqlpic="select top 3 * from news_purpose where int(maoa)=1 and id<>(select top 1 * from news_purpose where int(maoa)=1) order by newsdate desc,id desc"


我这样做会出现http500错误呀
奋斗男人 2005-12-15
  • 打赏
  • 举报
回复
select * from table where id<>(select top 1 * form table)
KimSoft 2005-12-15
  • 打赏
  • 举报
回复
呵呵,在oracle中是select * from(select * from table) where rownum > 1 and rownum < n+1

sqlserver关注一下。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧