0
這是我想對事件執行的查詢,但它返回null,並且它不會每週向表中插入任何行。關於事件的MySQL錯誤1064
insert into weekly (winddir,windspeedmph,windgustmph,windgustdir,windspdmph_avg2m,winddir_avg2m,windgustmph_10m,windgustdir_10m,humidity,tempf,rainin,dailyrainin,pressure,batt_lvl,light_lvl)
VALUE (
(select AVG(winddir) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windspeedmph) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windgustmph) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windgustdir) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windspdmph_avg2m) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(winddir_avg2m) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windgustmph_10m) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(windgustdir_10m) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(humidity) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(tempf) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(rainin) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(dailyrainin) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(pressure) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(batt_lvl) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()),
(select AVG(light_lvl) from daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW())
)
,當我嘗試這樣:
insert into weekly (winddir,windspeedmph,windgustmph,windgustdir,windspdmph_avg2m,winddir_avg2m,windgustmph_10m,windgustdir_10m,humidity,tempf,rainin,dailyrainin,pressure,batt_lvl,light_lvl)
VALUE (
(select AVG(winddir) from daily),
(select AVG(windspeedmph) from daily),
(select AVG(windgustmph) from daily),
(select AVG(windgustdir) from daily),
(select AVG(windspdmph_avg2m) from daily),
(select AVG(winddir_avg2m) from daily),
(select AVG(windgustmph_10m) from daily),
(select AVG(windgustdir_10m) from daily),
(select AVG(humidity) from daily),
(select AVG(tempf) from daily),
(select AVG(rainin) from daily),
(select AVG(dailyrainin) from daily),
(select AVG(pressure) from daily),
(select AVG(batt_lvl) from daily),
(select AVG(light_lvl) from daily)
)
SELECT * FROM daily WHERE `timeStamp` BETWEEN DATE_SUB(NOW(), INTERVAL 1 DAY) AND NOW()
我得到的錯誤1064
有人可以幫我請。