Finding Nth ID in an Index

  • I was trying to find a way to find out the ID for specified position in an index

    Lets say an index was of these numbers and sorted of course

    1234

    1456

    100000

    120000

    800000

    ...

    And I wanted the 3rd ID in that index, which would be 100000

    Essentially, I want to treat the index like an Array

  • Like so...

    select top 1 ID

    from (select top 5 ID

    from table1

    order by ID ASC) t

    order by ID desc



    A.J.
    DBA with an attitude

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply