Salut,
tu peux deja le faire en 3 etapes
1/ faire une requete avec les nombre de jours ouverts + une requete avec le nombre de jours fermes pour chaque mois
par exemple (a adapter bien sur + ajuster si besoin)
SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = False GROUP BY Month(ChampDate)
SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = True GROUP BY Month(ChampDate)
2/ faire une requete UNION
1 2 3
| SELECT Mois, Nb_Jours & ' ouvrés' As Jours FROM (SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = False GROUP BY Month(ChampDate))
UNION ALL
SELECT Mois, Nb_Jours & ' fériés' As Jours FROM (SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = True GROUP BY Month(ChampDate)) |
3/ faire un order by par mois
1 2 3 4 5 6 7 8
| SELECT Mois, Jours
FROM
(
SELECT Mois, Nb_Jours & ' ouvrés' As Jours FROM (SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = False GROUP BY Month(ChampDate))
UNION ALL
SELECT Mois, Nb_Jours & ' fériés' As Jours FROM (SELECT Month(ChampDate) As Mois, COUNT(ChampDate) AS NB_Jours FROM TaTable WHERE JourFerie = True GROUP BY Month(ChampDate))
)
ORDER BY Mois |
Partager