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.
21 lines
482 B
21 lines
482 B
-- Query 23
|
|
|
|
SELECT
|
|
facture.numfacture AS 'facture',
|
|
DATE_FORMAT(facture.datefacture, "%d/%m/%y") AS 'date',
|
|
COUNT(comprend.numcons) AS 'nb conso'
|
|
FROM comprend
|
|
INNER JOIN facture ON comprend.numfacture = facture.numfacture
|
|
WHERE facture.datefacture < "20060222"
|
|
GROUP BY facture.numfacture
|
|
HAVING `nb conso` > 3
|
|
ORDER BY SUM(comprend.numcons) DESC;
|
|
|
|
/* == RESULT ==
|
|
"Facture","Date","Nb conso"
|
|
1003,"04/12/05",6
|
|
1203,"21/02/06",5
|
|
1103,"21/01/06",5
|
|
1200,"21/02/06",4
|
|
*/
|