INTEGER DIVISION> : SELECT L.log_timestamp FROM log L GROUP BY DATE( log_timestamp ), hour( log_timestamp ) DIV 2 SqlFiddleDemo