> Is there a way I can get a set of records incrementally such as to get 2
> then the next query get the next 2 then at the end of all records to get the
> 2 from the beginning? I need to keep going incrementally by 2 in a circle.

I don't know any way to do this directly with SQL, but I could be wrong,
stored procedures may help you here, I do not use mysql 5, so I have not
played with them yet.

I would probably do this with a second table, and some SQL in the middle of
it all to make it happen.  Your second table would simply store the last id
that you selected.

So, you select from your second table, to get the last id you retrieved.
Them you select from the primary table, where id > retreived_id limit 2,
once you have that, take the ID from the last record in the 2 you just got
back, and insert/update that data into your second table.

Make sure you add in app logic to deal with cases where the second table has
never been inserted into, also when you wrap your record set, it will need
to be reset, but I think you get the idea.
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.



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

Reply via email to