在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)"';
有人有想法吗?
答案 0 :(得分:1)
你可以试试这个:
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