limiting amount of returned rows?

limiting amount of returned rows?

am 27.03.2006 17:40:15 von Sonnich

Hi!

How do I limit the amount of returned rows?

Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) -
is there a parameter for that like rownum in Oracle?

e.g. select * from someplace where rownum < 400 order by sometimefield?

BR
Sonnich

Re: limiting amount of returned rows?

am 27.03.2006 20:48:46 von Bill Karwin

"Sonnich" wrote in message
news:1143474015.916066.15640@z34g2000cwc.googlegroups.com...
> How do I limit the amount of returned rows?

The optional LIMIT clause of queries can do this.

Read about it on this page:
http://dev.mysql.com/doc/refman/5.0/en/select.html

Starting at the bullet item that begins, " The LIMIT clause can be used to
constrain the number of rows returned..."

Regards,
Bill K.

Re: limiting amount of returned rows?

am 27.03.2006 21:12:37 von avidfan

Sonnich wrote:

> Hi!

> How do I limit the amount of returned rows?

> Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) -
> is there a parameter for that like rownum in Oracle?

> e.g. select * from someplace where rownum < 400 order by sometimefield?

> BR
> Sonnich


http://dev.mysql.com/doc/refman/4.1/en/limit-optimization.ht ml

select * from someplace where order by sometimefield limit 400;

Re: limiting amount of returned rows?

am 28.03.2006 14:28:40 von Sonnich

Bill Karwin wrote:
> "Sonnich" wrote in message
> news:1143474015.916066.15640@z34g2000cwc.googlegroups.com...
> > How do I limit the amount of returned rows?
>
> The optional LIMIT clause of queries can do this.
>
> Read about it on this page:
> http://dev.mysql.com/doc/refman/5.0/en/select.html
>
> Starting at the bullet item that begins, " The LIMIT clause can be used to
> constrain the number of rows returned..."

Thanks, that works well.

Sonnich