CREATE TABLE `call_log` (
`call_id` int(11) NOT NULL AUTO_INCREMENT,
`call_time` datetime NOT NULL,
`caller` varchar(32) NOT NULL,
`name_recording_url` varchar(123) DEFAULT NULL,
`phone` varchar(10) NOT NULL,
`forwarded_from` varchar(16) NOT NULL,
`called_number` varchar(16) DEFAULT NULL,
`sent_to_phone` varchar(10) NOT NULL,
`market` varchar(64) NOT NULL,
`station` varchar(12) NOT NULL,
`distributor_id` int(11) NOT NULL,
`distributor_phone` varchar(10) NOT NULL,
`answered` enum('Yes','No') NOT NULL DEFAULT 'No',
`mode` enum('Live','Test') NOT NULL,
PRIMARY KEY (`call_id`)
)
So, I would like to populate the station in distinct time with total calls.
So for example, we have station ABCD and ASDF. ABCD has 30 records, ASDF has 10 records. I want to get their records each hour.
Example output would be:
station call_time(H) total_call
ABCD 10 5 // ABCD has 5 calls at 10am
ABCD 12 20 // ABCD has 20 calls at 12pm
ABCD 15 5 // ABCD has 5 calls at 3pm
ASDF 08 4 // ASDF has 4 calls at 8am
ASDF 05 2 // ASDF has 2 calls at 5pm
ASDF 13 2 // ASDF has 2 calls at 1pm
ASDF 22 2 // ASDF has 2 calls at 10pm