php - How to regularly import data from a mysql data table to another table in the same database
PHP中文网2017-05-16 13:04:21
0
2
352
Want to import all today's sign-in data table signInfo into another table yesterdaySignInfo in the same database at 23:59 every day? Can it be done using only sql statements?
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;
Can be solved using mysql events
//Open event scheduler
//Create event
SQL can be written like this