Ver originalSELECT a.sector, COUNT(DISTINCT g.id) Grupos, COUNT(a.id_alumno) Alumnos, SUM(h.horas) TotalHsFROM horas h INNER JOIN grupos g ON g.id = h.id_grupo INNER JOIN alumnos a ON a.id_grupo = g.idGROUP BY a.sector