我试图通过timestamp
表中的mysql
进行分区。但是它返回了一个错误
CREATE TABLE tblemployeepunch (
fld_id int(11) NOT NULL AUTO_INCREMENT,
fld_date Varchar(15) DEFAULT NULL,
fld_rawpunchdate varchar(25) DEFAULT NULL,
fld_rawpunchtime varchar(25) DEFAULT NULL,
fld_cardno varchar(50) DEFAULT NULL,
fld_reasoncard varchar(20) DEFAULT NULL,
fld_mode varchar(20) DEFAULT NULL,
fld_punchdatetime varchar(50) DEFAULT NULL,
fld_crtdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY fld_id (fld_id,fld_crtdate),
KEY in_timesheet (fld_cardno,fld_punchdatetime,fld_mode,fld_rawpunchtime),
KEY in_emppunch (fld_cardno,fld_rawpunchdate,fld_punchdatetime)
)
PARTITION BY HASH(DAYOFYEAR(fld_crtdate))
PARTITIONS 12;
答案 0 :(得分:4)
嗯,错误信息非常清楚。不要按时区相关列中的值进行分区。使用数据类型为date
,datetime
或int
的列(事先在单独的列中计算DAYOFYEAR(fld_crtdate)
)或任何其他列。