我用了一种方法,但是速度太慢,求各位大侠给个效率高的SQL语句,或者优化一下。谢谢!"select * from (select  * from Code_Standard where CODE_STRING Like  '2105%' and Rule_ID=4) where rownum < 21 minus select * from ( select  * from Code_Standard where CODE_STRING Like  '2105%' and Rule_ID=4)  where rownum < 0"

解决方案 »

  1.   

    http://topic.csdn.net/t/20050218/10/3789089.html
      

  2.   

    给你一个例子从6到10select r,e.* from (select rownum r,last_name,salary from (
    select last_name,salary from employees order by nvl(salary,0) desc)) e
    where r between 6 and 10;
      

  3.   

    我用了这种方法:
    select * from (select rownum as rid, CODE_STANDARD.*  from (Select * from CODE_STANDARD Where RULE_ID=4 ) where rownum >0) where   rid< 50  我想返回CODE_STANDARD表中的所有字段,但是CODE_STANDARD.* 这里报错,谁帮我改一下吗?
      

  4.   

    select * from (select rownum as rid, aaa .* from (Select * from CODE_STANDARD Where RULE_ID=4 ) aaa where rownum >0) where rid< 50
      

  5.   

    select a.col,
    a.num
    from
       (
            select col,
            row_number() over(order by col) num
             from tab
       ) a
    where a.num  >10
    and a.num   < 20
      

  6.   

    把你的改了下
    select * from 
    (
      select * from  Code_Standard where CODE_STRING Like  '2105%' and Rule_ID=4 and rownum<21 minus select * from  Code_Standard where CODE_STRING Like  '2105%' and Rule_ID=4 and rownum<0
    )
      

  7.   

    select * from (select rownum as rid, a.*  from (Select * from CODE_STANDARD Where RULE_ID=4 ) as a where rownum >0) where   rid< 50  
    试试这个
      

  8.   

    使用with来实现分页功能
    with Code_Standard_tmp as (select rownum sn,u.* from Code_Standard u )
    select * from Code_Standard_tmp where sn between 10 and 20当然还有别的方法,但我目前测试这种方法的速度最快。
      

  9.   

    panku(辣椒虫) 的再排序一下就更好了,呵呵 ~~~ 
    with Code_Standard_tmp as (select rownum sn,u.* from (select * from Code_Standard order by 排序字段) u)
    select * from Code_Standard_tmp where sn between 10 and 20
      

  10.   

    panku(辣椒虫) 的再排序一下就更好了,呵呵 ~~~ 
    with Code_Standard_tmp as (select rownum sn,u.* from (select * from Code_Standard order by 排序字段) u)
    select * from Code_Standard_tmp where sn between 10 and 20
      

  11.   

    panku(辣椒虫) 的再排序一下就更好了,呵呵 ~~~ 
    with Code_Standard_tmp as (select rownum sn,u.* from (select * from Code_Standard order by 排序字段) u)
    select * from Code_Standard_tmp where sn between 10 and 20