I have written a query that counts records hour by hour:
select TO_CHAR(copied_timestamp, \'YYYY-MM-DD HH24\'),count(*) from req group by
TO_CHAR(copied_time
I created a table called TBL_NUMBERS
CREATE TABLE `TBL_NUMBER` (`n` int(11) NOT NULL)
and inserted records from 1 to 1000. Now I can generate any kind of date range using this query:
SELECT '2012-06-21' + INTERVAL n-1 [DAY | HOUR | MINUTE] or as dateRange
FROM TBL_NUMBER
WHERE '2012-06-21' + INTERVAL n-1 [DAY | HOUR | MINUTE] <= '2012-06-23';
Then I can join this table with my results to fill the date gap.
If i need more than 1000 date range I can insert more records in TBL_NUMBER
If you have any better idea, I'm eager to know that ;)