I have all the months and in each month, there is some data (Enrollment), given the case that there is no data in that month I want that month to appear with a zero. This is the query I have:
Select meses.mes as MES,
SUM(cantidad) as MAT
FROM vista_matriculas_todas
join meses
on meses.id = vista_matriculas_todas.mes_corte
where vista_matriculas_todas.ano_inf = 2017
group by vista_matriculas_todas.mes_corte,
meses.mes,
vista_matriculas_todas.mes_corte
For example, I want to get this result:
Enero 174738
Febrero 0
Marzo 10344
Abril 0
Mayo 0
Junio 0
Julio 0
Agosto 0
Septiembre 0
Octubre 0
Noviembre 0
Diciembre 0