SELECT

		LAST_DAY (LEFT(prt.dateSysteme,10)) DateComptable,
		prt.codePrestataire,`fn_libelle_prestataire`(prt.codePrestataire) AS prestataire,
		prt.idBeneficiaire,e.numeroBeneficiaire,e.nomBeneficiaire,e.prenomsBeneficiaire,prt.datePrestation  ,COUNT(0) decompte 
FROM p_prestationactes prt 
INNER JOIN beneficiaire e ON (e.id=prt.idBeneficiaire)
INNER JOIN adherent a ON ((e.idPolice=a.idPolice) AND ( a.id=e.idAdherent))
INNER JOIN  police C ON  (e.idPolice = C.id)
INNER JOIN  gc_assureur G ON  (C.codeGcAssureur = G.codeGcAssureur)	
LEFT JOIN p_feuillemaladie f ON (f.numeroFeuilleMaladie =prt.numeroFeuilleMaladie )
LEFT JOIN `p_affection` af ON (f.codeAffection =af.codeAffection )
-- WHERE LEFT(prt.datePrestation,10)>='2023-01-01'
WHERE (LEFT(prt.dateSysteme,10)  BETWEEN '2023-03-01' AND '2023-03-31' )
 AND prt.codeActe='C'
  AND prt.codePrestataire NOT IN ('CE0416','PR1176','CE1215','CE1232','CE1287','PR1175','CE1276')
 -- AND prt.codePrestataire IN ('CE1727')
GROUP BY LAST_DAY (LEFT(prt.dateSysteme,10)),prt.idBeneficiaire,e.nomBeneficiaire,e.prenomsBeneficiaire,prt.datePrestation ,prt.codePrestataire
 HAVING COUNT(0)>1
ORDER BY DateComptable,prestataire,prt.datePrestation,prt.idBeneficiaire

 
 SELECT * FROM prestataire
 WHERE libelle LIKE '%FIDRA%'
 
 
 
 /*
 

SELECT prt.* 
FROM p_prestationactes prt -- JOIN p_facture B ON (B.id=prt.idfacture)
JOIN `p_feuillemaladie` f ON (f.`numeroFeuilleMaladie`=prt.numeroFeuilleMaladie)
-- WHERE (LEFT(prt.dateSysteme,10)  BETWEEN '2023-02-20' AND '2023-02-20' )
WHERE LEFT(prt.datePrestation,10)>='2023-02-20'
AND prt.idBeneficiaire='26171'


*/