我在SQL中运行这段代码,并希望在一定时间内获得数据。这里每小时40分钟,也可以是10分钟;这个想法是为了获得更短时间框架的快照它在间隔为1的情况下有效但是当你超过这个值时,它就不起作用了
查询输出:'There is no data to display'.
SELECT *
FROM `xxxx.yyyy.data`
WHERE
executedAt > "2022-05-18 12:00:00"
AND executedAt < "2022-05-18 12:40:00"
AND executedAt > "2022-05-18 13:00:00"
AND executedAt < "2022-05-18 13:40:00"
AND executedAt > "2022-05-18 14:00:00"
AND executedAt < "2022-05-18 14:40:00"
谢谢你的帮助
如果我理解你的话,这就行了
SELECT *
FROM `xxxx.yyyy.data`
WHERE
(executedAt > '2022-05-18 12:00:00' AND executedAt < '2022-05-18 12:40:00') OR
(executedAt > '2022-05-18 13:00:00' AND executedAt < '2022-05-18 13:40:00') OR
(executedAt > '2022-05-18 14:00:00' AND executedAt < '2022-05-18 14:40:00')