SELECT F.*
FROM p_prestationactes A
INNER JOIN p_facture Bp ON (Bp.id=A.idfacture)
INNER JOIN beneficiaire B ON ( B.id=A.idBeneficiaire )
INNER JOIN police Po ON (Po.id=B.idPolice)
INNER JOIN gc_assureur Gc ON  (Po.codeGcAssureur = Gc.codeGcAssureur)
INNER JOIN p_feuillemaladie F ON (F.numeroFeuilleMaladie=Bp.numeroFeuilleMaladie)
INNER JOIN adherent a ON ((Po.id=a.idPolice) AND (Po.codeSociete=a.codeSociete) AND ( a.id=B.idAdherent))
INNER JOIN prestataire p  ON (A.codePrestataire=p.codePrestataire)
WHERE (LEFT(Bp.dateSysteme,10) BETWEEN '2022-01-01' AND '2022-12-31')
AND Bp.codePrestataire IN ('CE1629')
-- AND A.montantApayer>0  
AND B.idPolice=203
AND codeActe='A00000003'





UPDATE p_prestationactes A
INNER JOIN p_facture Bp ON (Bp.id=A.idfacture)
INNER JOIN beneficiaire B ON ( B.id=A.idBeneficiaire )
INNER JOIN police Po ON (Po.id=B.idPolice)
INNER JOIN gc_assureur Gc ON  (Po.codeGcAssureur = Gc.codeGcAssureur)
INNER JOIN p_feuillemaladie F ON (F.numeroFeuilleMaladie=Bp.numeroFeuilleMaladie)
INNER JOIN adherent a ON ((Po.id=a.idPolice) AND (Po.codeSociete=a.codeSociete) AND ( a.id=B.idAdherent))
INNER JOIN prestataire p  ON (A.codePrestataire=p.codePrestataire)
SET 
	codeActe='A00000003',
	A.ValeurActe=0,A.fraisReel=0,A.montantTm=0,A.montantArembourser=0,A.baseRemboursement=0
	,A.fraisRetenu=0,A.montantApayerCalc=0,A.montantApayer=0,A.prixTarif=0,A.prixBase=0,A.fraisReelBase=0,
	F.fraisReel=0,F.montantTm=0,F.montantArembourser=0,
	F.fraisRetenu=0,F.fraisAssure=0,F.prixBase=0,F.fraisReelBase=0,
	Bp.fraisReel=0,Bp.montantTm=0,Bp.montantArembourser=0,Bp.fraisAssure=0,
	Bp.fraisRetenu=0,Bp.montantApayerCalc=0,Bp.montantApayer=0,Bp.prixBase=0,Bp.fraisReelBase=0
WHERE (LEFT(Bp.dateSysteme,10) BETWEEN '2022-01-01' AND '2022-12-31')
AND Bp.codePrestataire IN ('CE1629')
-- AND A.montantApayer>0  
AND B.idPolice=203
AND codeActe='A00000003';