出了什么问题? 我成功创建了预定的活动。 它没有工作,并且在“结束”附近出现了问题。语法,MySQL说......
DELIMITER ||
CREATE
EVENT ScheduledCalls
ON SCHEDULE EVERY 5 MINUTE
STARTS NOW()
ON COMPLETION PRESERVE
DO
BEGIN
-- insert if less than 60 minutes
INSERT INTO tblcalls(
DateTimeReceived, ClientID, CorpName, StartDay,
StartTime, FromInfo, FromContact, FromPhone, ToInfo,
ToContact, ToPhone, Memo,Service, StrService, AR, Status)
SELECT
DateTimeReceived, ClientID, CorpName, StartDay,
StartTime, FromInfo, FromContact, FromPhone, ToInfo,
ToContact, ToPhone, Memo, Service, StrService, AR, Status
FROM
tblscheduledcalls
WHERE
TIMEDIFF(StartDateTime, NOW()) < "00:60:00";
-- delete inserted record(s) from tblcalls
DELETE FROM tblscheduledcalls
WHERE
TIMEDIFF(StartDateTime, NOW()) < "00:60:00";
END ||
DELIMITER ;
答案 0 :(得分:0)
试试这个:
DELIMITER $$
CREATE
EVENT ScheduledCalls
ON SCHEDULE EVERY 5 MINUTE
STARTS NOW()
ON COMPLETION PRESERVE
DO
BEGIN
-- insert if less than 60 minutes
INSERT INTO tblscheduledcalls(
DateTimeReceived, ClientID, CorpName, StartDay,
StartTime, FromInfo, FromContact, FromPhone, ToInfo,
ToContact, ToPhone, Memo,Service, StrService, AR, Status)
SELECT
DateTimeReceived, ClientID, CorpName, StartDay,
StartTime, FromInfo, FromContact, FromPhone, ToInfo,
ToContact, ToPhone, Memo, Service, StrService, AR, Status
FROM
tblcalls
WHERE
TIMEDIFF(StartDateTime, NOW()) < "00:60:00";
-- delete inserted record(s) from tblcalls
DELETE FROM tblscheduledcalls
WHERE
TIMEDIFF(StartDateTime, NOW()) < "00:60:00";
END;
$$
DELIMITER ;