MySQL Forums
Forum List  »  Oracle

Re: rownum-Problem
Posted by: Josh Chamas
Date: April 14, 2005 12:08AM

Jeff Whippo wrote:
> So if we take this problem one step further:
>
> I'm looking for a way to page through result sets.
> For simplicity, let's say the result set of my
> query has 100 rows. I want to display increments
> of 10 rows on a web page. With Oracle, I could
> just do something like "select * from mytable
> where rownum between 20 and 30" (excuse the syntax
> - it's been a while for oracle). But in MySQL,
> all I see is that it provides me is a way to limit
> the number of rows returned but no way to provide
> a starting point e.g. 20 like in the my example.
> In other words, "select * from mytable limit 10"
> will always give me the FIRST 10 rows. What if I
> want the NEXT 10 rows, or the next, or the next?
>
> Any ideas how to do this in MySQL?

Please see...

http://dev.mysql.com/doc/mysql/en/select.html

You can do LIMIT with an offset, like LIMIT 0,10 for the first 10 rows,
or LIMIT 20, 10 for the 3rd set of 10 rows.

Regards,

Josh

Josh Chamas
Director, Professional Services
MySQL Inc., www.mysql.com
Get More with MySQL! http://www.mysql.com/consulting

Options: ReplyQuote


Subject
Views
Written By
Posted
17937
August 06, 2004 12:28AM
28397
September 26, 2004 09:04AM
11998
October 09, 2004 03:02PM
22646
October 10, 2004 12:56PM
12514
December 22, 2004 07:05AM
13516
December 22, 2004 01:59PM
9692
April 13, 2005 01:25PM
Re: rownum-Problem
13004
April 14, 2005 12:08AM
7129
April 26, 2005 02:12AM
7645
April 20, 2005 04:37PM
10022
April 23, 2005 09:48AM
5685
August 26, 2008 03:47AM
5898
April 26, 2005 02:16AM
5624
October 18, 2005 02:57PM
5583
November 16, 2005 04:58PM
19174
August 08, 2006 07:45AM
5358
December 14, 2008 10:01PM
5524
February 05, 2009 04:49PM
4733
December 27, 2008 03:27AM
4824
December 27, 2008 04:19AM
6547
February 08, 2007 02:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.