I'm not sure I am doing this right but the code below return 0. Shouldn't it be 10?
select @startId:= 0;
select id
from tableA a
where id>@startId
and id not in (select id from tableB)
order by id
limit 10;
select @this_id:= MAX(id) from tableA;