sql select rows between 1000 and 2000 1

sql select rows between 1000 and 2000

SELECT TOP 1000 column_id
FROM (SELECT TOP 2000 column_id
		FROM table_name ORDER BY column_id ASC) sub
 ORDER BY sub.column_id DESC

Here is what the above code is Doing:
1. The inner query is selecting the top 2000 rows from the table, ordered by column_id in ascending order.
2. The outer query is selecting the top 1000 rows from the inner query, ordered by column_id in descending order.

Similar Posts