Hi! I need to write selective data from one table to another one (with some joins). There are two options: 1) stored procedure in MariaDB or 2) do it with Phalcon and an action of a controller that calls itself again (say, after 100 reads/writes).
My question is, how can I realize way number 2?
This is easy: $datasets = Model::find(... 'limit' => 100); foreach ($datasets as $dataset): write-action endforeach;
Call function via URL again with last_read_id
But how do I get the next 100 one? With raw SQL I would do something like this: select * from foo where id = (select min(id) from foo where id > $last_read_id)
Sorry, but maybe I just not see the forest for the trees right now.
Thanks alot Aljoscha