1775059804 select * from patients where op_processed=0 and op_attempt_no<3 and cliniko_id in (select patient_id from appointments) order by id limit 0,201775059804