mysql根据当前时间创建表
作者:互联网
复制主表结构并创建
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 ;
标签:EXECUTE,PREPARE,创建,stmt1,当前,mysql,table,主表,sqlstr 来源: https://www.cnblogs.com/stronger-xsw/p/16692601.html