• ORACLE gives unique rowID's to SQL result sets, the author is right to point out that this is really cool.

    For this question, however, SQL server allows very elegant solutions.

    To get the 5th maximum:

    SELECT Min(Ordered_Value_List.Quantity)

    FROM

    (

    SELECT TOP 5 [Quantity]

    FROM dbo.[Sales Line]

    ORDER BY [Quantity] DESC

    ) Ordered_Value_List

    And for 5th minimum:

    SELECT MAX(Ordered_Value_List.Quantity)

    FROM

    (

    SELECT TOP 5 [Quantity]

    FROM dbo.[Sales Line]

    ORDER BY [Quantity] ASC

    ) Ordered_Value_List