Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    64

    Unanswered: Last N rows from a Table

    Hi,

    I have a table having 73000 records i am trying to write a query to fetch last 37000 records from it.

    Table name XYZ
    Primary Key COL1
    Other columns COL2 COL3

    Please help!!!!!!!

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Please define what you mean by "last 37000". Do you mean the 37000 with the greatest COL1 values?

  3. #3
    Join Date
    Jan 2010
    Posts
    64

    hi

    My table has 74000 records( order by asc col1) , i want to retrive last 37000 records.

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    How about:
    Code:
    select * from
    ( select col1, col2, col3
      from xyz
      order by col1 desc
    )
    where rownum <= 37000;

Posting Permissions

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