DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: how toget values between 5th and 10th rows

  1. #1
    Join Date
    Apr 2003
    Posts
    19

    how toget values between 5th and 10th rows

    hi
    i want to retrieve the values of rows between 5th and 10th rows out of 500 rows in a table.
    thanks
    SKNaidu
    sknaidu

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    You should have a date column in the table..then you can select between 5th and the 10th row..otherwise its not possible in relational database..

    By the whats the criteria of 5th and 10th row in a 500 row table ?


    regards
    Hrishy

  3. #3
    Join Date
    Apr 2003
    Location
    Delhi
    Posts
    51

    Re: how toget values between 5th and 10th rows

    try using rownum
    for e.g-
    select customerid from customer where rownum <11
    MINUS
    select customerid from customer where rownum<6;


    Originally posted by SKNaidu
    hi
    i want to retrieve the values of rows between 5th and 10th rows out of 500 rows in a table.
    thanks
    SKNaidu
    regards
    nik

  4. #4
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Oh no no no no.

    Do not use MINUS for this proble - ROWNUM is the proper solution.

    You can add paging to any query by wrapping it in paging logic:
    Code:
    
    SELECT 
       * 
    FROM 
       ( 
       SELECT 
          INNER.*, 
          ROWNUM 
             AS QUERY_ROWNUM 
       FROM 
          ( 
          SELECT
             O.ORG_PK      ,
             OH.DSPLY_NM
          FROM
             ORG      O   ,
             ORG_HDR   OH
          WHERE
             O.ORG_DBA_NM   LIKE   :ORG_NM   ||   '%'   AND
             OH.ORG_PK      =      O.ORG_PK
          ORDER BY
             O.ORG_PK
          ) INNER 
       WHERE 
          ROWNUM <= :EndRow
       ) OUTER
    WHERE
       OUTER.QUERY_ROWNUM >= :StartRow
    - Chris
    Christopher R. Long
    [email protected]
    But that's just my opinion. I could be wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width