Nombre de lecteurs actifs annuel

SELECT YEAR (issuedate) AS ANNEE, categorycode AS CATEGORIE, COUNT(DISTINCT borrowernumber) AS NB_LECTEURS
FROM (
SELECT issuedate, borrowernumber FROM old_issues
UNION ALL
SELECT issuedate, borrowernumber FROM issues
) AS all_issues
LEFT JOIN borrowers USING (borrowernumber)
GROUP BY CATEGORIE WITH ROLLUP

Cette requête permet de répondre en partie aux indicateurs Publics de l’ESGBU