Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ID column1 column2
- -------------------------
- 1 test1 test1
- 2 test2 test2
- 3 test3 test3
- ID column1 column2
- -------------------------
- 3 test1 test1
- 2 test2 test2
- 1 test3 test3
- SELECT
- ROW_NUMBER() OVER (ORDER BY ID DESC) AS ID,
- column1,
- column2
- FROM dbo.Table1
- ORDER BY ID DESC
- SELECT x.* FROM (
- SELECT TOP 7 t.*
- FROM dbo.Table1 t
- ORDER BY t.ID DESC
- ) x
- ORDER BY x.ID DESC
Add Comment
Please, Sign In to add comment