1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| SELECT
nombreEU,
COUNT(nombreEU) nombreEU
FROM (SELECT COUNT(enfants_enfant_id) AS nombreET, COUNT(DISTINCT enfants_enfant_id) AS nombreEU
FROM enfants_has_activites_annuelles
JOIN activites_annuelles ON activites_annuelles.activite_id = enfants_has_activites_annuelles.activites_activite_id
UNION ALL
SELECT COUNT(enfants_enfant_id) AS nombreET, COUNT(DISTINCT enfants_enfant_id) AS nombreEU
FROM enfants_has_cvl
JOIN cvl ON cvl.cvl_id = enfants_has_cvl.cvl_cvl_id
UNION ALL
SELECT COUNT(enfants_enfant_id) AS nombreET, COUNT(DISTINCT enfants_enfant_id) AS nombreEU
FROM enfants_has_clsh
JOIN clsh ON clsh.clsh_id = enfants_has_clsh.clsh_clsh_id
UNION ALL
SELECT COUNT(enfants_enfant_id) AS nombreET, COUNT(DISTINCT enfants_enfant_id) AS nombreEU
FROM enfants_has_activites
JOIN activites ON activites.activite_id = enfants_has_activites.activites_activite_id)
GROUP BY
nombreEU
HAVING
COUNT(nombreEU) = 1
ORDER BY
nombreEU |
Partager