SELECT act.date,
        COALESCE(SUM(CASE WHEN 1 THEN 1 ELSE 0 END), 0) AS present,
        COALESCE(SUM(CASE WHEN adh.id_category = 4 THEN 0 ELSE 1 END), 0) AS benevole,
        COALESCE(SUM(CASE WHEN adh.membre_du_conseil_d_administration LIKE '%Salarié%' ESCAPE "\" THEN 1 ELSE 0 END), 0) AS salarie,
        COALESCE(SUM(CASE WHEN adh.genre = 'Femme' THEN 1 ELSE 0 END), 0) AS femme,
        COALESCE(SUM(CASE WHEN adh.genre = 'Homme' THEN 1 ELSE 0 END), 0) AS homme,
        COALESCE(SUM(CASE WHEN adh.qpv IS NOT NULL AND adh.qpv IS NOT 'Non' THEN 1 ELSE 0 END), 0) AS qpv,
        COALESCE(SUM(CASE WHEN adh.annee_naissance > (act.date - 18) THEN 1 ELSE 0 END), 0) AS dixhuit,
        COALESCE(SUM(CASE WHEN adh.annee_naissance < (act.date - 60) THEN 1 ELSE 0 END), 0) AS soixante
FROM users adh
JOIN services_users act
ON adh.id = act.id_user
WHERE act.id_service = 6
AND 2024 < act.date AND  act.date < 2025
GROUP BY act.date;
