...
Codeblock |
---|
CREATE TABLE `contrexx_stats_requests_new` ( `id` int(9) unsigned NOT NULL AUTO_INCREMENT, `timestamp` int(11) DEFAULT '0', `pageId` int(6) unsigned NOT NULL DEFAULT '0', `page` varchar(255) binary NOT NULL DEFAULT '', `visits` int(9) unsigned NOT NULL DEFAULT '0', `sid` varchar(32) NOT NULL DEFAULT '', `pageTitle` varchar(250) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `pageId` (`pageId`) ) ENGINE=MyISAM; INSERT INTO `contrexx_stats_requests_new` ( `pageId`, `visits` ) SELECT `pageId`, SUM(`visits`) AS `visits` FROM `contrexx_stats_requests` GROUP BY `pageId`; UPDATE `contrexx_stats_requests_new` AS `stats_new` INNER JOIN ( SELECT `stats1`.`pageId`, `stats1`.`timestamp`, `stats1`.`page`, `stats1`.`sid`, `stats1`.`pageTitle` FROM `contrexx_stats_requests` AS `stats1` LEFT JOIN `contrexx_stats_requests` AS `stats2` ON `stats1`.`pageId` = `stats2`.`pageId` AND `stats1`.`timestamp` < `stats2`.`timestamp` WHERE `stats2`.`timestamp` IS NULL ) AS `stats_old` ON `stats_new`.`pageId` = `stats_old`.`pageId` SET `stats_new`.`timestamp` = `stats_old`.`timestamp`, `stats_new`.`page` = `stats_old`.`page`, `stats_new`.`sid` = `stats_old`.`sid`, `stats_new`.`pageTitle` = `stats_old`.`pageTitle` WHERE `stats_new`.`pageId` = `stats_old`.`pageId`; RENAME TABLE `contrexx_stats_requests` TO `contrexx_stats_requests_before_hotfix_220517`, `contrexx_stats_requests_new` TO `contrexx_stats_requests`; |
SQL