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) <= 13 THEN 'Jusque 13 ans' WHEN (!!param1!! - empr_year) >13 and (!!param1!! - empr_year)<=24 THEN '14 à 24 ans' WHEN (!!param1!! - empr_year)>24 and (!!param1!! - empr_year)<=59 THEN '25 à 29 ans' WHEN (!!param1!! - empr_year)>59 THEN '60 ans et plus'  ELSE 'erreur sur age' END as categ_age, count(id_empr) from empr left join empr_codestat on empr_codestat=idcode where (year(empr_date_adhesion)=!!param1!! or year(empr_date_expiration)=!!param1!! or (year(empr_date_expiration)>=!!param1!! and year(empr_date_adhesion)<=!!param1!!)) group by libelle,1, categ_age order by libelle,1