select concat(hour(arc_debut),"h-",hour(arc_debut)+1,"h") as "Tranche horaire", sum(if(weekday(arc_debut)=0,1,0)) as "Lundi", sum(if(weekday(arc_debut)=1,1,0)) as "Mardi", sum(if(weekday(arc_debut)=2,1,0)) as "Mercredi", sum(if(weekday(arc_debut)=3,1,0)) as "Jeudi", sum(if(weekday(arc_debut)=4,1,0)) as "Vendredi", sum(if(weekday(arc_debut)=5,1,0)) as "Samedi", sum(if(weekday(arc_debut)=6,1,0)) as "Dimanche", sum(1) as "Total" FROM pret_archive WHERE arc_debut between "!!debut_periode!!" and "!!fin_periode!!" GROUP BY hour(arc_debut) ORDER BY hour(arc_debut)