您的位置:首页 > 数据库

sqlserver,查询第N到M条记录,其中ID为唯一

2013-03-25 22:58 260 查看
1、SELECT TOP m-n+1 *
  FROM Score
  WHERE (id NOT IN
      (SELECT TOP n-1 id
       FROM Score))

2、select top M-N * from yourTable where id not in(select top N-1 id from table)

3、select top M-N * from 表名 where id in (select distinct(id) from 表名)

有时间记录下,上面三种方法,只用了第一种就没再试了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐