What you are looking for is to have all months as a result of whether they exist or do not exist in the database, for a set of results you need to have all months in a query like union, and then join your table over the years and for months
select coalesce(sum(`level` = 1),0) level1count
coalesce(sum(`level` = 2),0) level2count ,y,m
from
(select 1 as m,2014 as y
union
.
.
.
union
select 12 as m ,2014 as y
) months
left join t on(months.m = month(t.time) and months.y = year(t.time))
group by months.m, year(t.time)
A better approach than joining is to have a table containing all your months over years, and then attach it to you with a table