user10753983
user10753983

Reputation: 11

How to select n number of rows in ms access

Here is a table patients in MS access database, There is 20 records, I want to select first 0 10 records and after 11-20 records for pagination. How to solve this problem

Upvotes: 1

Views: 1286

Answers (1)

BlackICE
BlackICE

Reputation: 8926

If it's ok to order your output by primary key you could do something like this:

Select top 10 *
from patients
where patientid > @id

You would need to keep track of the last id shown on the page, sending that to the query every time. This won't work if you sort by something other than the id

Upvotes: 1

Related Questions