首页  >  文章  >  数据库  >  sqlserver,查询第N到M条记录,其中ID为唯一

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

WBOY
WBOY原创
2016-06-07 17:43:471287浏览

sqlserver,查询第N到M条记录,其中ID为唯一 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 表名 wher

sqlserver,网站空间,查询第N到M条记录,香港服务器租用,其中ID为唯一

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 表名)

 

有时间记录下,香港空间,上面三种方法,只用了第一种就没再试了。

发表于

 

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn