-- select * from avenant where idPolice=205

 SELECT * FROM etatadherent WHERE idAdherent="6446" 

-- 1--
INSERT INTO etatadherent (idPolice,idAdherent,codeEtatAdherent,dateEtat,dateSysteme,idAvenant,`user`,motifEtat)
SELECT -- numeroAdherent,
"205" AS idPolice,id AS idAdherent,codeEtatAdherent,NOW() dateEtat,NOW() dateSysteme, 
"830" AS idAvenant,"charles-eric","Demande de remise en vigueur de la direction générale"
FROM adherent WHERE (idPolice=205) AND numeroAdherent IN ("02050370")



-- 2 --	
UPDATE adherent SET codeEtatAdherent="V", dateEtat=NOW() WHERE (idPolice=205) AND (codeEtatAdherent="SP") AND numeroAdherent="02050370";
	
-- 3 --	
INSERT INTO etatbeneficiaire (idPolice,idBeneficiaire,codeEtatBeneficiaire,dateEtat,dateSysteme,idAvenant,`user`,motifEtat)
SELECT "205" AS idPolice,id AS idBeneficiaire,codeEtatBeneficiaire,NOW() dateEtat,NOW() dateSysteme, 
"830" AS idAvenant,"charles-eric","Demande de remise en vigueur de la direction générale"
FROM beneficiaire WHERE (idPolice=205) AND numeroAdherent="02050370" -- AND (codeEtatBeneficiaire="SP") ;

-- 4 --	
UPDATE beneficiaire SET codeEtatBeneficiaire="V", dateEtat=NOW() 
WHERE (idPolice=205) AND (codeEtatBeneficiaire="SP") AND numeroAdherent="02050370";


-- select* from beneficiaire where nombeneficiaire="SANOGO" and prenomsBeneficiaire="MADOUSSOU" and idPolice=205



