日期:2014-05-18  浏览次数:20468 次

语句中TOP 30可以获得排序的前30个条数据,如何得到排在中间的比如60-90的?
比如
select   top   30   *   from   table   ORDER   BY   id   DESC
获得前30个数据项。
如何的到排序在60-90的30个数据项?

------解决方案--------------------
select top 30 * from (select top 60 * from table ORDER BY id) a order by id DESC
------解决方案--------------------
select top 30 * from table where id not in (select top 60 id from table ORDER BY id) order by id DESC
------解决方案--------------------
select top 30 * from (select top 60 * from table ORDER BY id) a order by id DESC

------解决方案--------------------
select top 31 * from
(select top 90 * from table order by id)
a order by a.id DESC

------解决方案--------------------
冒牌邹的...有些问题.

select top 30 * from table where id not in (select top 60 id from table ORDER BY id) order by id

如果是not in 就别 desc排序 ...