From: "Aman Raheja" <[EMAIL PROTECTED]>

> Suppose I want to select items 10 to 30 from a table tab, which has 36
rows.
> What could be the sql query ?
> Thank you.
> Aman
>
> PS: I am using cgi-perl.



How are these items identified as "items 10 to 30" in the table?

Does that mean that when you SELECT * FROM the table, those are the items
that are displayed in rows 10-30? If so, you shouldn't depend on them being
as such. It's much better to always have an "ORDER BY fieldname" clause in
your query.

At any rate, though, you can specify a range with "LIMIT offset,numrows",
such as this:

SELECT * FROM tablename ORDER BY field1 LIMIT 10;
   (selects rows 1-10)
SELECT * FROM tablename ORDER BY field1 LIMIT 10,20;
   (selects rows 11-20)
SELECT * FROM tablename ORDER BY field1 LIMIT 20,30;
   (selects rows 21-30)
SELECT * FROM tablename ORDER BY field1 LIMIT 9,20;
   (selects rows 10-30)


--
denonymous
www.coldcircuit.net



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to