复制主表结构并创建
SET @sqlstr = CONCAT('create table you_table_',DATE_FORMAT(CURDATE(),'%Y%m%d'),' like you_table'); PREPARE stmt1 FROM @sqlstr ; EXECUTE stmt1 ;
复制主表数据
SET @sqlstr = CONCAT('insert into you_table_',DATE_FORMAT(CURDATE(),'%Y%m%d'),' select * from you_table'); PREPARE stmt1 FROM @sqlstr ; EXECUTE stmt1 ;