SELECT p.cardnumber, p.surname, p.firstname, p.phone, p.address, p.city, p.email, c.date_due, (TO_DAYS(curdate())-TO_DAYS( date_due)) AS ‘Jours de retards’, i.itype, b.title, b.author, i.barcode, COUNT(h.biblionumber) AS ‘NB de réservations’, CONCAT(‘‘,b.biblionumber,’‘) FROM borrowers p LEFT JOIN issues c USING (borrowernumber) LEFT JOIN items i USING (itemnumber) […]
Archives annuelles: 2019
SELECT c.date_due, p.categorycode, b.title, b.author, i.itemcallnumber, i.barcode, i.location FROM issues c LEFT JOIN items i ON (c.itemnumber=i.itemnumber) LEFT JOIN borrowers p ON (c.borrowernumber=p.borrowernumber) LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber) ORDER BY c.date_due AS Cette requête croise des données de plusieurs […]
SELECT b.budget_name, format(sum(o.listprice*o.quantity),2) AS ‘amount spent’ FROM aqorders o LEFT JOIN aqbudgets b USING (budget_id) WHERE o.datereceived IS NOT NULL GROUP BY b.budget_name Le rapport propose d’obtenir les sommes dépensées par poste budgétaire. Seules les dépenses pour des documents réceptionnés […]
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 […]