oppure ogni ulteriore queri dovrebbe avere un "id not in (select id from tabella where condizioni_precedenti)" e quindi fai fare il lavoro al db..buh