T
T
TopClans2018-02-08 13:31:40
MySQL
TopClans, 2018-02-08 13:31:40

How to make a MySQL query grouped by timestamp every 60 minutes?

There is a database in which monitoring data is added every minute, including the time in timestamp.
It is necessary to make a request with minimum, maximum data for a period of time, for example, every 5, 15, 60 minutes.
That is, you need to look at the maximum value of some parameter in the period from January 1 to January 31, with a period of one hour.
Here is an example query: SELECT min(sum), max(sum) FROM info WHERE time > 0 AND time < 2592000
GROUP BY suggests itself, but how can I set the interval for the timestamp?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-02-08
@Rsa97

GROUP BY FLOOR(`time` / 3600)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question