Question

It is possible?

I know you can limit your queries with

 SELECT TOP 10 name FROM customers ORDER BY name

but how can I get names from 50 to 100?

I need to make a pagination but I can't find a way to do it.

Thank you very much.

Was it helpful?

Solution

There is more simple way:

SELECT * FROM table1 WHERE RECNO()>50 AND RECNO()<=100

OTHER TIPS

You can do two opposite sorted SELECT TOP queries.

see: http://thepcspy.com/read/paging_in_sql/

SELECT name FROM 
 (SELECT TOP 50 name FROM
  (SELECT TOP 100 name FROM customers ORDER BY name ASC) AS a
 ORDER BY name DESC
 ) AS b
ORDER BY name ASC

Here, 50 is page size and 100 - 50 (ie: 50) is start index.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top