J'ai créé une requête dans laquelle je compte le nombre de nouveaux encarts par heure. Le problème est que ma requête n'affiche pas les heures sans nouvelles entrées.
Comment puis-je résoudre ce problème facilement ?
SELECT
count(HOUR(delivered))as count,
CASE
WHEN HOUR(delivered) = 0 THEN '0'
WHEN HOUR(delivered) = 1 THEN '1'
WHEN HOUR(delivered) = 2 THEN '2'
WHEN HOUR(delivered) = 3 THEN '3'
WHEN HOUR(delivered) = 4 THEN '4'
WHEN HOUR(delivered) = 5 THEN '5'
WHEN HOUR(delivered) = 6 THEN '6'
WHEN HOUR(delivered) = 7 THEN '7'
WHEN HOUR(delivered) = 8 THEN '8'
WHEN HOUR(delivered) = 9 THEN '9'
WHEN HOUR(delivered) = 10 THEN '10'
WHEN HOUR(delivered) = 11 THEN '11'
WHEN HOUR(delivered) = 12 THEN '12'
WHEN HOUR(delivered) = 13 THEN '13'
WHEN HOUR(delivered) = 14 THEN '14'
WHEN HOUR(delivered) = 15 THEN '15'
WHEN HOUR(delivered) = 16 THEN '16'
WHEN HOUR(delivered) = 17 THEN '17'
WHEN HOUR(delivered) = 18 THEN '18'
WHEN HOUR(delivered) = 19 THEN '19'
WHEN HOUR(delivered) = 20 THEN '20'
WHEN HOUR(delivered) = 21 THEN '21'
WHEN HOUR(delivered) = 22 THEN '22'
WHEN HOUR(delivered) = 23 THEN '23'
END AS intervals
FROM
Wardrobe_CloakTable
WHERE
payingcustomerID = 2
AND DAY(delivered) = 09
AND MONTH(delivered) = 09
AND YEAR(delivered) = 2016
GROUP BY intervals