SELECT * FROM beneficiaire
WHERE numeroBeneficiaire IN ('0322000401','0238001302')

-- 1 defacturer
SELECT 
 p.* -- (idPolice,idAdherent,idBeneficiaire,numeroBeneficiaire)
-- p.* (idAdherent,numeroAdherent,idBeneficiaire,numeroBeneficiaire) 
-- e.* -- (idPolice,idAdherent,idBeneficiaire,numeroBeneficiaire)
FROM p_facture f
INNER JOIN p_prestationactes p ON (f.id=p.idFacture)
INNER JOIN p_feuillemaladie e ON (e.numeroFeuilleMaladie=p.numeroFeuilleMaladie)
WHERE f.numeroBeneficiaire IN ('0322000401','0238001302')
AND (LEFT(dateSysteme,10>='2023-01-01' )
/*
AND p.codeGarantie="DEN" 
AND f.idBeneficiaire IN (27003,28161);*/

-- 1 AHDEHRENT
UPDATE p_facture f
INNER JOIN p_prestationactes p ON (f.id=p.idFacture)
INNER JOIN p_feuillemaladie e ON (e.numeroFeuilleMaladie=p.numeroFeuilleMaladie)
SET 
f.idPolice=76,f.idAdherent=7180,f.idBeneficiaire=20173,f.numeroBeneficiaire="0076001201",
p.idAdherent=7180,p.numeroAdherent="00760012",f.idBeneficiaire=20173,f.numeroBeneficiaire="0076001201",
e.idPolice=76,e.idAdherent=7180,e.idBeneficiaire=20173,e.numeroBeneficiaire="0076001201"
WHERE f.numeroFeuilleMaladie IN (38923,38941,38953,38957)
AND p.codeGarantie="DEN" AND f.idBeneficiaire=21203;

-- 2 CONJOINT
UPDATE p_facture f
INNER JOIN p_prestationactes p ON (f.id=p.idFacture)
INNER JOIN p_feuillemaladie e ON (e.numeroFeuilleMaladie=p.numeroFeuilleMaladie)
SET 
f.idPolice=76,f.idAdherent=7180,f.idBeneficiaire=20174,f.numeroBeneficiaire="0076001202",
p.idAdherent=7180,p.numeroAdherent="00760012",f.idBeneficiaire=20174,f.numeroBeneficiaire="0076001202",
e.idPolice=76,e.idAdherent=7180,e.idBeneficiaire=20174,e.numeroBeneficiaire="0076001202"
WHERE f.numeroFeuilleMaladie IN (38923,38941,38953,38957)
AND p.codeGarantie="DEN" AND f.idBeneficiaire=21491;

-- 3 ENFANT 1
UPDATE p_facture f
INNER JOIN p_prestationactes p ON (f.id=p.idFacture)
INNER JOIN p_feuillemaladie e ON (e.numeroFeuilleMaladie=p.numeroFeuilleMaladie)
SET 
f.idPolice=76,f.idAdherent=7180,f.idBeneficiaire=20175,f.numeroBeneficiaire="0076001203",
p.idAdherent=7180,p.numeroAdherent="00760012",f.idBeneficiaire=20175,f.numeroBeneficiaire="0076001203",
e.idPolice=76,e.idAdherent=7180,e.idBeneficiaire=20175,e.numeroBeneficiaire="0076001203"
WHERE f.numeroFeuilleMaladie IN (38923,38941,38953,38957)
AND p.codeGarantie="DEN" AND f.idBeneficiaire=21492;

-- 4 ENFANT 2
UPDATE p_facture f
INNER JOIN p_prestationactes p ON (f.id=p.idFacture)
INNER JOIN p_feuillemaladie e ON (e.numeroFeuilleMaladie=p.numeroFeuilleMaladie)
SET 
f.idPolice=76,f.idAdherent=7180,f.idBeneficiaire=20176,f.numeroBeneficiaire="0076001204",
p.idAdherent=7180,p.numeroAdherent="00760012",f.idBeneficiaire=20176,f.numeroBeneficiaire="0076001204",
e.idPolice=76,e.idAdherent=7180,e.idBeneficiaire=20176,e.numeroBeneficiaire="0076001204"
WHERE f.numeroFeuilleMaladie IN (38923,38941,38953,38957)
AND p.codeGarantie="DEN" AND f.idBeneficiaire=21493;

