select location_libelle as Localisation,codestat_libelle as Codestat, tdoc_libelle as Support, a0.expl_custom_small_text as Type,count(distinct a1.expl_custom_origine) as Total from expl_custom_values as a0, expl_custom_values as a1, exemplaires left join docs_type on expl_typdoc=idtyp_doc LEFT JOIN docs_location ON idlocation= expl_location LEFT JOIN docs_codestat ON idcode=expl_codestat where a0.expl_custom_champ=2 and a1.expl_custom_champ=3 and date_format(a1.expl_custom_date,'%Y')='!!annee!!' and a1.expl_custom_origine=a0.expl_custom_origine and expl_id=a1.expl_custom_origine and expl_location in (!!locationn!!) group by a0.expl_custom_small_text, Support, Localisation, Codestat ORDER BY Localisation, Codestat