Lets say I have a student table and there are 1000 records in it.
I would like to write such a query that should select only 100 records but I should be able to define the range.
Ex. 100 records showing from 501 to 600
or 100 records showing from 101 to 200
P.S. Yes! There is a identity column but it consists of random numbers.
Thank you for your help.
This should do it.
This will give you a consistent result set even if you don’t have a sequential id on the table, so you can perform meaningful paging or what have you.