| | |
LIMIT, TOP help
Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 35
Reputation:
Solved Threads: 0
So i'm used to using mysql, but i'm on a project right now that uses an access database, and I'm looking for a way to replace LIMIT. I googled around and found the information on TOP, but it doesnt totally replace the functionality. For example if a user were to search the database for phone numbers of anyone named jim... and wanted to page through 50 at a time it would look something like this in mysql.
That would return the first 50, page 2 would look like:
page 3
Using the TOP clause I would do something like
That would only get me my first page.... how do I tell it to skip a certain number of records, then grab 50.
SELECT phonenumber FROM users WHERE firstname= 'jim' LIMIT 0, 50; That would return the first 50, page 2 would look like:
SELECT phonenumber FROM users WHERE firstname= 'jim' LIMIT 49, 50; page 3
SELECT phonenumber FROM users WHERE firstname= 'jim' LIMIT 99, 50; Using the TOP clause I would do something like
SELECT TOP 50 phonenumber FROM users WHERE firstname= 'jim' That would only get me my first page.... how do I tell it to skip a certain number of records, then grab 50.
Last edited by headedtomexico; Jul 23rd, 2009 at 8:47 pm.
•
•
Join Date: Jan 2009
Posts: 35
Reputation:
Solved Threads: 0
OK, i found the answer, I guess I was being hasty when i did it, here it is if anyone else stumbles onto this post needing help
Page1
Page2
Page3
Page1
SELECT TOP 50 phonenumber FROM users WHERE firstname = 'jim'; Page2
SELECT TOP 50 phonenumber FROM users WHERE firstname= 'jim' AND phonenumber NOT IN (SELECT TOP 50 phonenumber FROM users WHERE firstname = 'jim') ;Page3
SELECT TOP 50 phonenumber FROM users WHERE firstname= 'jim' AND phonenumber NOT IN (SELECT TOP 100 phonenumber FROM users WHERE firstname = 'jim'); ![]() |
Similar Threads
- Need help on Nested Repeater. Need to limit queries. (ASP.NET)
- How to retrieve top 10 revords in mysql 4 (MySQL)
- How do i LIMIT in Access (MS Access and FileMaker Pro)
- getting list of top rated products (MySQL)
- Get rid of the editing time limit!!!!! (DaniWeb Community Feedback)
- New to Daniweb (Community Introductions)
- Range of records in Top clause (MS SQL)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
Other Threads in the MS Access and FileMaker Pro Forum
- Previous Thread: About Set Fine Condition On Access
- Next Thread: Complex Reporting
| Thread Tools | Search this Thread |





