插入新行后,事件无法正常运行

时间:2019-04-06 20:39:25

标签: mysql sql

我创建了一个事件,该事件将表Loan中的值插入其中,而成员还没有在表NotYetReturned中返回到期的书。它确实将成员存储在表NotYetReturned中,但是,当我在表Loan中插入新行且成员的书已经过期时,它不会记录在表NotYetReturned中。

Table for Loan

data X = Y { a ∷ A }

This is correct

CREATE TABLE NotYetReturned LIKE Loan # First, create a table with the columns of Loan
SET GLOBAL event_scheduler = ON;    

CREATE EVENT DueDate_expired                    
ON SCHEDULE EVERY 1 SECOND          
DO INSERT INTO NotYetReturned SELECT * FROM Loan 
WHERE CURDATE() > DueDate and ReturnDate is NULL;

SELECT * FROM NotYetReturned;  # Check who hasn't returned their books yet

This is not correct

应包括新行。

0 个答案:

没有答案