查询N-M条记录。 select IDENTITY(int,1,1) as iid,* into #temptable from yourtable select top M * from #temptable where iid>=NOR:select top M * from yourTable where id not in(select top N-1 id from table) ID为表具有唯一值的任何字段
select top 10 * from table where id not in (select top 100 id from table) select * from (select top 20 * from table order by id) a where id not in (select top 9 id from table order by id)
select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表 select * from #temp where ID_Num>10 and ID_Num<=20
推荐: exec('SELECT Top '+cast(@PageSize as varchar)+' * FROM T WHERE SortField NOT IN (SELECT TOP '+cast(@PageSize* @Pagei as varchar)+' SortField from T )')
select top 20 col1 from t1
minus
select top 9 col1 from t1
(select top 9 col1 from t1) tab2 on tab1.col1 <> tab2.col1
black_snail(●龙飞虎○) ,你的什么方法?不解...
select * from (select top 20 * from table order by id) a where id not in (select top 9 id from table order by id)
select * from #temp where ID_Num>10 and ID_Num<=20
exec('SELECT Top '+cast(@PageSize as varchar)+' * FROM T WHERE SortField NOT IN (SELECT TOP '+cast(@PageSize* @Pagei as varchar)+' SortField from T )')