Bonsoir,
je veux additioner les 2 COUNT des 2 requêtes suivante en une requête:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 SELECT nom_adherent, COUNT(E.*) AS "nb emprunt" FROM adherent NATURAL JOIN emprunt E GROUP BY nom_adherent; SELECT nom_adherent, COUNT(H.*) AS "nb emprunt" FROM adherent NATURAL JOIN histoemprunt H GROUP BY nom_adherent;
mais cela ne marche pas il me dit, ERROR: more than one row returned by a subquery used as an expression.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 SELECT nom_adherent, COUNT(E.*)+(SELECT COUNT(H.*) FROM adherent NATURAL JOIN histoemprunt H GROUP BY nom_adherent) FROM adherent NATURAL JOIN emprunt E GROUP BY nom_adherent;
Comment faire?
Merci d'avance pour votre aide.
Partager