SQL Query Get 2nd Row Data

Here’s example to get 2nd row data with sql query

1
2
3
4
5
6
7
    ;WITH YourCTE AS
    (
    SELECT TOP 2
        *, ROW_NUMBER() OVER(ORDER BY [YourColumn]) AS RowNumber
        FROM [YourTable]
    )
    SELECT * FROM YourCTE WHERE RowNumber=2

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.