gpt4 book ai didi

mysql - 如何在Mysql中每5分钟指定子句Where

转载 作者:行者123 更新时间:2023-11-28 23:33:27 24 4
gpt4 key购买 nike

在Mysql请求中,我想指定每5分钟选择一次值

 $sql = 'SELECT * FROM table WHERE datetime BETWEEN "2016-01-04 00:00:00" 
$sql .= 'AND "2016-01-04 12:00:00" + "(and INTERVAL 5 minutes)"';

有人有想法吗?

最佳答案

你可以试试这个:

SELECT * FROM table
WHERE datetime BETWEEN '2016-01-04 00:00:00' AND '2016-01-04 12:00:00'
GROUP BY
UNIX_TIMESTAMP(datetime) DIV 300

关于mysql - 如何在Mysql中每5分钟指定子句Where,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36593328/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com