想在每天23:59的时候将今天的签到数据表signInfo全部导入到同库中的另一张表yesterdaySignInfo中?只用sql语句能完成吗?
PHP中文网2017-05-16 13:06:21
用mysql事件可以解决
//开启事件调度器
set global event_scheduler = on
// 创建事件
delimiter $$
create event if not exists yesterday_sign_log
on schedule every 1 day
starts timestamp '2017-05-03 23:50'
on completion preserve enable
do begin
drop table if exists yesterdaySignInfo;
create table yesterdaySignInfo like signInfo;
insert into yesterdaySignInfo select * from signInfo;
end $$
delimiter;
PHP中文网2017-05-16 13:06:21
sql可以这么写
drop table if exists yesterdaySignInfo;
create table yesterdaySignInfo like signInfo;
insert into yesterdaySignInfo select * from signInfo;