select case when empr_sexe='1' then 'Hommes' when empr_sexe='2' then 'Femmes' else 'indéterminé' end as Sexe, libelle as 'Code statistique', CASE WHEN  (!!param1!! - empr_year) <= 14 THEN 'Jusque 14 ans' WHEN (!!param1!! - empr_year) >14 and (!!param1!! - empr_year)<=64 THEN '15 à 64 ans' WHEN (!!param1!! - empr_year)>64 and (!!param1!! - empr_year)<=99 THEN '65 à 99 ans' WHEN (!!param1!! - empr_year)>99 THEN '100 ans et plus'  ELSE 'erreur sur age' END as categ_age, count(id_empr) as Nombre from empr left join empr_codestat on empr_codestat=idcode where empr_date_adhesion BETWEEN "!!date1!!" and "!!date2!!" group by libelle,1, categ_age order by libelle,1