-- requete sur numero de telephone dans une sous question
-- ATTENTION L'ID EST CELUI DE LA QUESTION ET NON PAS DE LA CAMPAGNE
insert into coregistration.export_auto_non_eligible (export_auto_non_eligible_affichage)
SELECT coregistration_reponse_affichage
  FROM coregistration.coregistration_reponse
WHERE coregistration_reponse_id_question = 160
AND SUBSTRING(coregistration_reponse_id_reponse from 1 for 2) NOT IN ('01', '02', '03', '04', '05', '06', '07', '09');
-- on passe les lignes traités à exportable 3 pour ne plus les selectionner
update coregistration set coregistration_eligible = 3
where coregistration_coregistration_affichage in
(
SELECT coregistration_reponse_affichage
  FROM coregistration.coregistration_reponse
WHERE coregistration_reponse_id_question = 160
AND SUBSTRING(coregistration_reponse_id_reponse from 1 for 2) NOT IN ('01', '02', '03', '04', '05', '06', '07', '09')
);
-- fin requete numero de telephone
