Results 1 to 4 of 4

Thread: selecting nth row

  1. #1
    Join Date
    Aug 2003
    Location
    London
    Posts
    110

    selecting nth row

    quick and simple question really,

    if you have a table and want to see the 6th row only

    how will you do it?

    thanks

    Shaunt

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    any unique column in the table? please post sample data

  3. #3
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    You should at least have a criteria column for sorting.

    select top 1 * from (select top 5 * from TBName order by Id)a order by Id desc

    In this example, ID is used for sorting

  4. #4
    Join Date
    Apr 2004
    Posts
    7

    Lightbulb Check this out

    Asumming your Table is "myemp" and ID is used for sorting

    select *
    from (select * from myemp where rownum<7 order by ID desc) a
    where rownum<2
    order by ID

    Regds

Posting Permissions

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