При выполнения запроса в PHPMyAdmin происходит подвисание.
PHPMyAdmin не выдает никаких сообщений, а просто показывает сообщение "Загрузка", приходится убивать процесс.
SELECT download_count.id,
date_format(start_date, '%D %b %Y') as 'start',
date_format(max(wp1.tracking_date),'%M') as 'mouth',
date_format(max(wp1.tracking_date),'%D %b %Y') as 'last',
COUNT(wp1.download_id) as 'last_mouth_count',
COUNT(wp2.download_id) as 'today_count'
FROM download_count
LEFT JOIN download_info as wp1 on download_count.id=wp1.download_id AND NOT ISNULL(wp1.tracking_date) AND date_format(wp1.tracking_date, '%Y-%m')=date_format(now(), '%Y-%m')
LEFT JOIN download_info as wp2 on download_count.id=wp2.download_id AND NOT ISNULL(wp2.tracking_date) AND date_format(wp2.tracking_date, '%Y-%m-%d')=date_format(now(), '%Y-%m-%d')
WHERE download_count.id=wp2.download_id AND download_count.id=wp1.download_id
Таблица download_count
CREATE TABLE `download_count` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
`url` varchar(150) NOT NULL,
`full` int(1) NOT NULL DEFAULT '0',
`plugin_id` int(4) unsigned NOT NULL,
`start_date` datetime NOT NULL,
`used_date` datetime DEFAULT NULL,
`count` bigint(20) NOT NULL DEFAULT '0',
`cat_id` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8;
Таблица download_info
CREATE TABLE `download_info` (
`tracking_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`download_id` bigint(20) unsigned NOT NULL,
`tracking_referer` varchar(355) DEFAULT NULL,
`tracking_date` datetime NOT NULL,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`user_refferal` varchar(350) DEFAULT NULL,
`additional_info` varchar(32) DEFAULT NULL,
`version_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`tracking_id`),
KEY `download_id` (`download_id`)
) ENGINE=InnoDB AUTO_INCREMENT=50243 DEFAULT CHARSET=utf8;
Спасибо.