1 2 3 4 5 6 7 8 9 10 11 12 13
|
SELECT `Marque`,`PointdeVente`,count(*) as cde, SUM(Societe) as societe, sum(`Entretien`) as entretien, SUM(IF(`Organisme` <> "0", 1, 0)) as fi, sum(`Box`) as box, sum(`CLD`) as cld,
round((sum(`Entretien`)/(count(*)-sum(Societe)))*100,2) as T_entretien,
round(SUM(IF(`Organisme` <> "0", 1, 0))/(count(*))*100,2) as T_fi,
round((sum(`Box`)/(count(*)-SUM(Societe)))*100,2) as T_box,
round((sum(`CLD`)/(count(*)-SUM(Societe)))*100,2) as T_cld,obj,DATEDIFF("2013-12-31","2013-12-01")
FROM `table 2`
INNER JOIN objectif ON objectif.id_concession=`table 2`.`PointdeVente` AND mois_obj=MONTH("2013-12-01") AND annee_obj=YEAR("2013-12-01")
WHERE `DateCommande`
BETWEEN "2013-12-01" AND "2013-12-31"
AND `PointdeVente`='1'
GROUP BY `Marque`,`PointdeVente` |
Partager