|
-
Jun 15th, 2006, 10:14 AM
#1
Thread Starter
Addicted Member
SQL question
how can i retrieve the top 20 from a table, then the next 20 records?
can anybody help
-
Jun 15th, 2006, 11:06 AM
#2
Member
Re: SQL question
You could start by telling your query to ORDER BY id, or some unique Integer...then, clause it with LIMIT 20.
Get the ID of your 20th item, and place it in some variable, "LastAccessed". Then, for the next query, "SELECT * FROM table WHERE id > lastAccessed ORDER BY id ASC LIMIT 20".
Repeat step two ("Get the ID of your 20th item, and place...")
This should work for ya.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|