CREATE TABLE `tmp` (
`CallID` bigint(8) unsigned NOT NULL,
`InfoID` bigint(8) unsigned NOT NULL,
`CallStartTime` datetime NOT NULL,
KEY `CallStartTime` (`CallStartTime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
在这个表中我想再添加一列PartitionID
int(4) unsigned NOT NULL,这里我想插入 PartitionID 列的数据,这意味着 PartitionID=(DAYOFYEAR('2009-01-01 00:00:00')) = 1我想自动插入数据... PartitionID=(DAYOFYEAR( CallStartTime
))
我的表旧数据是这样的
(144, 56, '2011-06-19 1:00:00'),
(100, 57, '2011-09-01 10:24:00'),
(168, 68, '2012-07-13 12:10:06'),
(207, 30, '12012-12-05 12:12:00'),
(112, 14, '2013-05-19 1:00:00');
(177, 90, '2013-06-05 12:12:00'),
(144, 56, '2013-06-19 1:00:00'),
(168, 68, '2013-07-13 12:10:06'),
(119, 17, '2013-08-01 10:24:00'),
(110, 10, '2013-08-05 12:12:00'),
(113, 11, '2013-08-13 12:10:06'),
(100, 57, '2013-09-01 10:24:00'),
添加新列后...我想要这样
只PartitionID
自动插入数据而不是手动插入
(177, 90, '2010-06-05 12:12:00',156),
(144, 56, '2011-06-19 01:00:00',170),
(100, 57, '2011-09-01 10:24:00',244),
(168, 68, '2012-07-13 12:10:06',194),
(207, 30, '2012-12-05 12:12:00',340),
(112, 14, '2013-05-19 01:00:00',139),
(177, 90, '2013-06-05 12:12:00',156),
(144, 56, '2013-06-19 01:00:00',170),
(168, 68, '2013-07-13 12:10:06',194),
(119, 17, '2013-08-01 10:24:00',213),
(110, 10, '2013-08-05 12:12:00',217),
(113, 11, '2013-08-13 12:10:06',225),
(100, 57, '2013-09-01 10:24:00',244)