SQL Select query that returns a range

sql, sql-server

Solution

With SQL Server :

Row Offset in SQL Server

With MySQL :

SELECT * FROM `your_table` LIMIT 10, 20

With Oracle :

SELECT * FROM `your_table` WHERE rownum >= 10 and rownum < 20;

With PostgreSQL :

SELECT * FROM `your_table` LIMIT 20 OFFSET 10

`your_table` must be replaced by your real table name

Problem

Possible Duplicate: Row Offset in MS SQL Server I want to select a range from x1 to x2. Just like you can select the top results: ``` SELECT TOP X * FROM TABLE SELECT TOP 5 * FROM tUsers ``` But I would like to select middle results. So if I want results 10-20 is there a way to query that? ``` SELECT 10-20 * FROM TABLE? ```

Original source

Related problems