I want to calculate the average difference between multiple dates: sent_date & view_date.
My table structure look like:
CREATE TABLE `mails` (
`m_id` int(8) NOT NULL AUTO_INCREMENT,
`sent_date` date NOT NULL DEFAULT '0000-00-00',
`view_date` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`l_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
Example data:
sent_date: 2013-06-01 view_date: 2013-06-02 difference: 2 days
sent_date: 2013-06-01 view_date: 2013-06-05 difference: 4 days
Average: 3 days