Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select records starting at a defined record # like LIMIT in MySQL?

Status
Not open for further replies.

KevinCO

Programmer
Oct 2, 2001
45
US
Instead of something like... SELECT TOP 50 FROM TABLE to get the top 50 records, I want to start at, say, record number 51 and return only 100 records including/after 51, So Records #51 to 151 are returned(like the LIMIT keyword in MySql). Thank you for taking the time to read my post.
 
Try something like
Code:
SELECT Top 101 num
FROM tbl
WHERE num NOT IN 
    (Select Top 50 num from tbl)
 
*BUMP*
Anyone find a solutions for this?

What I am trying to do is take 50 records and paginate them using SQL.

In other words, "SELECT * FROM tbl_foo" yield 50 records.

I want to be able to get the first 10 (1-10), then the next 10 (11-20), then the next 10 (21-30), and so forth.

I believe in MySQL you can do:
"SELECT * FROM tbl_foo LIMIT 0,10" for the first 10
"SELECT * FROM tbl_foo LIMIT 11,20" for the next 10
"SELECT * FROM tbl_foo LIMIT 21,30" for the next 10

and so forth.

What would the query be for the Microsoft Access Jet Engine ?
 
Did you ever find an answer to this in access. I have the same problem and would appreciate any help you can give. Thanks, Joel
 
The basic idea to get records X to Y:
SELECT TOP Y-X+1 *
FROM (SELECT TOP Y * FROM youTable ORDER BY yourSequencer) T
ORDER BY T.yourSequencer DESC


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top