select ... from the_table where id > $last_id order by id LIMIT 1