Hi experts,
I need an SQL query (in MS SQL) to select last X records, for example my table has 1000 records, I want to select last 10 records.
I know by using TOP I can do that, but it returns from first X records, not last X records.
Also I do not want to use DESC ordering.
Queries like: SELECT TOP 10 * FROM mytable ORDER BY field1 DESC
is not desired...
And also I need to select some records in middle, e.g. third ten records.
How can I perform these actions using MS SQL.
(Using MySQL, I think there is a keyword LIMIT to do that, but isn't working in MS SQL)
Any comment, would be highly appreciated.
Start Free Trial