直接用
select id from (select id,rownum con from testsort order by id) where con>=M and con<=N;

解决方案 »

  1.   

    支持 ORARichard(没钱的日子......)
      

  2.   

    ORARichard(没钱的日子......)
    的方法是不行的,而且要结合用户的查询条件,大家还是自己实际测试一下
      

  3.   

    select id from (select id,rownum con from testsort where ... order by id) where con>=M and con<=N;
    8i以上(含8i)8i以下
    select id from (select id,rownum con from (select id from testsort where ... group by id))
    where con>=M and con<=N;
      

  4.   

    如果是top200的話直接用select * from table where rownum<=200
    如果是要取中間幾條記錄的話,ORARichard(没钱的日子......) 的方法是正解
      

  5.   

    select id from 
          (select id, rownum roworder 
             from TestSort where rownum < 20 order by id
          ) 
    where roworder > 2;要先 rownum < 20
      

  6.   

    各位大虾还是看看这篇关于排序的文章把,也可能是我没说清楚,因我的是通用查询窗口,所以当符合用户的记录较多时,需要把日期最近的记录取出来。
    http://dev.csdn.net/develop/article/21/21371.shtm
      

  7.   

    我的oracle 版本是8i,现在问题是要动态把用户输入的查询条件加在where语句的后面
      

  8.   

    select id from (select id,rownum con from (select * from testsort where ... order by id)) where con>=M and con<=N;(select * from testsort where ... order by id)--其中这个语句你可以根据条件任意改变