当我尝试在mySQL中创建事件并键入此代码时,它会给出错误:
无法识别的语句类型即将结束
BEGIN
INSERT INTO orders (coinID, action, coinPrice, coinNewPrice, orderTime)
SELECT coinID, action, coinPrice, coinNewPrice, NOW()+1 AS orderTime FROM orders
WHERE coinID IN (SELECT id FROM coin WHERE isActive = 1 ORDER BY id ASC) AND coinID = 1 ORDER BY id DESC LIMIT 1;
INSERT INTO orders (coinID, action, coinPrice, coinNewPrice, orderTime)
SELECT coinID, action, coinPrice, coinNewPrice, NOW()+2 AS orderTime FROM orders
WHERE coinID IN (SELECT id FROM coin WHERE isActive = 1 ORDER BY id ASC) AND coinID = 2 ORDER BY id DESC LIMIT 1;
INSERT INTO orders (coinID, action, coinPrice, coinNewPrice, orderTime)
SELECT coinID, action, coinPrice, coinNewPrice, NOW()+3 AS orderTime FROM orders
WHERE coinID IN (SELECT id FROM coin WHERE isActive = 1 ORDER BY id ASC) AND coinID = 3 ORDER BY id DESC LIMIT 1;
END
它创建事件,但不会执行查询。