select case when empr_sexe='1' then 'Hommes' when empr_sexe='2' then 'Femmes' else 'Sexe non renseigné' end as Sexe, CASE WHEN  (!!annee!! - empr_year) <= 14 THEN 'De 0 à 14 ans' WHEN (!!annee!! - empr_year) >14 and (!!annee!! - empr_year) <= 64 THEN 'De 15 à 64 ans' WHEN ((!!annee!! - empr_year) >64 and empr_year!=0) THEN 'De 65 ans et plus' ELSE 'Année de naissance non renseignée' END as "Tranche d'âge", count(distinct id_empr) as 'Total nouveaux inscrits' from empr left join empr_categ on empr_categ=id_categ_empr left join docs_location on empr_location=idlocation where year(empr_date_adhesion)=!!annee!! and empr_location in (!!choixlocation!!) and empr_categ in (!!choixcateg!!) group by 1,2 order by 1,2