You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
533 B

-- Query 24
SELECT
consommation.numcons,
consommation.libcons,
(
SELECT COUNT(comprend.numfacture)
FROM comprend
WHERE comprend.numcons = consommation.numcons
) AS `nb factures`
FROM consommation
HAVING `nb factures` >= 2;
/* == RESULT ==
"NUMCONS","LIBCONS","Nb factures"
100,"Café",10
101,"Café double",13
102,"Café crème",11
105,"Chocolat",5
106,"Bière pression",6
107,"Bière 25 Cl",5
108,"Bière 33 Cl",13
110,"Bière 50 Cl",3
122,"Perrier",7
124,"Orangina",8
130,"Coca Cola",6
*/