我正在尝试设置一个表,该表将从最初创建表开始每小时更新一次。
我正在使用以下两个sql查询。
CREATE TABLE TEMPTAB
AS
SELECT ID, INTPOS, DATE
FROM TRANSVERSE
WHERE DATE BETWEEN '2014-06-01 00:00:00' AND '2014-11-10 07:57:01'
AND INTPOS IN ('W1','W2','W3','W4');
SQL RETURNS 13926结果
CREATE event GEN
ON schedule every '60:00' minute_second
do
INSERT INTO TEMPTAB (ID, INTPOS, DATE)
SELECT ID, INTPOS, DATE
FROM TRANSVERSE
WHERE DATE BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) AND NOW()
AND INTPOS IN ('W1','W2','W3','W4');
SQL退回0结果
创建事件是个问题,虽然我运行了这样的选择,以便我知道有数据:
select *
from transverse
where DATE BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) AND NOW()
AND INTPOS IN ('W1','W2','W3','W4')
这提供了大约200个结果。
任何人都可以告诉我到底我做错了什么吗?