MySQL gets the minimum and maximum range from the interval

So, I have a range of values, for example:

Symbol     Timestamp            Volume  Price   Open
NIF     2011-05-10 11:26:01     439757  1.3150  1.3100 
NIF     2011-05-10 11:25:01     439757  1.3150  1.3100 
NIF     2011-05-10 11:24:01     439757  1.3150  1.3100
NIF     2011-05-10 11:23:01     439752  1.3150  1.3100
NIF     2011-05-10 11:22:02     439752  1.3150  1.3100
NIF     2011-05-10 11:21:02     439752  1.3150  1.3100
NIF     2011-05-10 11:20:01     439752  1.3150  1.3100
NIF     2011-05-10 11:19:01     439752  1.3150  1.3100
NIF     2011-05-10 11:18:02     439752  1.3150  1.3100 
NIF     2011-05-10 11:17:01     439752  1.3150  1.3100
NIF     2011-05-10 11:16:02     439752  1.3150  1.3100
NIF     2011-05-10 11:15:01     431752  1.3150  1.3100
NIF     2011-05-10 11:14:02     431752  1.3150  1.3100
NIF     2011-05-10 11:13:02     431752  1.3150  1.3100
NIF     2011-05-10 11:12:01     431752  1.3150  1.3100
NIF     2011-05-10 11:11:01     431252  1.3150  1.3100
NIF     2011-05-10 11:10:02     431252  1.3150  1.3100
NIF     2011-05-10 11:09:01     428252  1.3150  1.3100
NIF     2011-05-10 11:08:01     427242  1.3150  1.3100
NIF     2011-05-10 11:07:02     427242  1.3150  1.3100
NIF     2011-05-10 11:06:02     427242  1.3150  1.3100
NIF     2011-05-10 11:05:01     427242  1.3150  1.3100
NIF     2011-05-10 11:04:02     427242  1.3150  1.3100
NIF     2011-05-10 11:03:02     427242  1.3150  1.3100
NIF     2011-05-10 11:02:02     427242  1.3150  1.3100
NIF     2011-05-10 11:01:02     427242  1.3150  1.3100
NIF     2011-05-10 11:00:02     427242  1.3150  1.3100

So between 11:01:02 and 11:26:01 I want to get the maximum, the minimum price.

Well, you say it is easy ... use the grouping function, etc., but it is not so simple. I need to create a range of minimum highs on the interval, so, for example, if the user enters an interval of 30 minutes, I need to return the range of the minimum maximum of the day, divided into smaller minimum maximum 30 minutes, throughout the day. For instance:

Now it’s 12 o’clock and the data arrives from 10 a.m., I need a minimum maximum range for

10:30 (min max range of 10-10:30), 
11:00 (10:30-11:00),
11:30 (11:00-11:30),
12:00 (11:30-12:00).

, , , GROUP BY, , , , .

- .

+3

All Articles