Возможно, это именно то, что и предложил
Rsa97:
SELECT allhours.h, IFNULL(mytablehours.c, 0)
FROM (SELECT '01' AS h UNION SELECT '02' UNION SELECT '03' UNION SELECT '04'
UNION SELECT '05' UNION SELECT '06' UNION SELECT '07' UNION SELECT '08'
UNION SELECT '09' UNION SELECT '10' UNION SELECT '11' UNION SELECT '12'
UNION SELECT '13' UNION SELECT '14' UNION SELECT '15' UNION SELECT '16'
UNION SELECT '17' UNION SELECT '18' UNION SELECT '19' UNION SELECT '20'
UNION SELECT '21' UNION SELECT '22' UNION SELECT '23' UNION SELECT '00')
as allhours
LEFT JOIN (SELECT HOUR(mytable.date) as h, COUNT(mytable.date) as c
FROM mytable
WHERE DATE(mytable.date) = CURDATE()
GROUP BY HOUR(mytable.date))
as mytablehours on mytablehours.h = allhours.h