Egor Egorov wrote:

Yes, use LIMIT clause to get only certain number of rows. For example, to retrieve 
forst 10 rows use the following statement:
        SELECT .. FROM .. ORDER BY .. LIMIT 0,10;

Then to retrieve next 10 rows:
        SELECT .. FROM .. ORDER BY .. LIMIT 10,10; retrieve rows 11-20




Assuming, as always, that the contents don't change at all in the mean time.


Remember that if someone deletes an item that fits into what you're currently viewing, the 'next' set of 10 items will actually skip over one.

For example:

1-10, [11-20], 21-30 (where the square brackets show your current view of the data)

If I delete 16 in another process somewhere for whatever reason (it happens), the item that was 21st will now be 20th, but when you ask for the next set of results (21-30) you'll miss the old 21 (now 20).

If this applies to you, try selecting to a temporary table and then 'window' your way through it using the LIMIT clause.

CREATE [ TEMPORARY ] TABLE search_result_abc123 SELECT .... (no limit);

Then for each 'page' of data, do:
SELECT * FROM search_result_abc123 LIMIT x, x+10;
--
Michael T. Babcock

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to