Opret endnu en tabel med en enkelt kolonne,
CREATE TABLE hours_list (
hour int NOT NULL PRIMARY KEY
)
Fyld den med alle 24 timer.
Foretag derefter en join på bordet for at udfylde nullerne.
SELECT
hs.hour as HOUR, COUNT(ws.ID) AS HOUR_STAT
FROM hours_list hs
LEFT JOIN cms_webstat ws ON hs.hour = hour(ws.TIMESTAMP_X)
GROUP BY hs.hour
ORDER BY hs.hour DESC