想在每天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;