How does MySQL count the data of the day every 2 hours?


SELECT HOUR(APPLY_TIME) as Hour,count(*) as Count 
    FROM sesc_social_security 
   WHERE
    APPLY_TIME like "2018-01-23%"
    GROUP BY HOUR(APPLY_TIME) ORDER BY Hour(APPLY_TIME);

the above statistics are on an hourly basis. Could you tell me how to count every 2 hours?

Jun.21,2021

SELECT HOUR(APPLY_TIME) as Hour,count(*) as Count 
    FROM sesc_social_security 
   WHERE
    APPLY_TIME like '2018-01-23%' AND Hour % 2 = 0
    GROUP BY HOUR(APPLY_TIME) ORDER BY Hour(APPLY_TIME);
Menu