SELECT CASE WHEN  (!!annee!! - empr_year) <= 11 THEN "0 à 11 ans" WHEN (!!annee!! - empr_year) >11 and (!!annee!! - empr_year)<=15 THEN "12 à 15 ans" WHEN (!!annee!! - empr_year)>14 and (!!annee!! - empr_year)<=24 THEN "15 à 24 ans" WHEN (!!annee!! - empr_year)>24 THEN "25 ans et plus"  ELSE "Age non défini" END as "Tranche d'âge", libelle as Catégorie, count(id_empr) as 'Nombre lecteurs' from empr LEFT JOIN empr_categ ON id_categ_empr=empr_categ where empr_categ in (!!categorie!!) and(year(empr_date_adhesion)=!!annee!! or year(empr_date_expiration)=!!annee!! or (year(empr_date_expiration)>=!!annee!! and year(empr_date_adhesion)<=!!annee!!)) group by 2,1 ORDER BY 2,1