Hello, I have been starded using redbean. I have a really big table and want to select 5000 rows at time using redbean! I want only the rows where the field "status" IS NULL This is my code:
$min = R::$c->begin()->addSQL('SELECT MIN(id)')->from('emailtable')->get('cell');
$max = R::$c->begin()->addSQL('SELECT MAX(id)')->from('emailtable')->get('cell');
for ($i = $min; $i < $max; $i = $i + 5000) {
$x = $i;
$y = $i + 5000;
$select = R::$c->begin()
->addSQL(' SELECT * ')
->from('emailtable')
->where(" id >= ? AND id < ? AND status IS NULL ")
->put($x)
->put($y)
->get();
}
Anyone know if this is the right way to go!
Should i use:
id >= ? AND id < ? AND status IS NULL
or maybe i should use BETWEEN but not sure.
My problem is The code above is sometimes selecting same id twice and that is what i do not expect!
there for i ask if there is a other solution four the code above!
All ides are welcome. It is really hard to find information about redbean/chunk/select/ example