I have a table. i need to get the median value based on time interval from this table.
Table data is like this :
date_time type value
2018-07-01 00:00:04 bottom#3 93.17
2018-07-01 00:00:04 top#45 100.28
2018-07-01 00:00:09 bottom#3 93.41
2018-07-01 00:00:09 top#45 100.28
2018-07-01 00:00:19 bottom#3 93.41
2018-07-01 00:00:19 top#45 100.85
2018-07-01 00:00:24 bottom#3 93.11
2018-07-01 00:00:24 top#45 101.13
2018-07-01 00:00:29 bottom#3 92.85
2018-07-01 00:00:29 top#45 101.13
2018-07-01 00:00:44 bottom#3 93.22
2018-07-01 00:00:44 top#45 101.13
we need to group the data based on time interval like 15 min or 30 min and also on type column after a time interval.
Expected output is something like :
date interval type median(value)
2018-07-01 00:00:15 top#45 --
2018-07-01 00:00:15 bottom#3 --
2018-07-01 00:00:30 top#45 --
2018-07-01 00:00:30 bottom#3 --
2018-07-01 00:00:45 top#45 --
2018-07-01 00:00:45 bottom#3 --
I don't have much more knowledge in MySQL and trying to get a time interval but not getting the result.
please help me to get this solution. Thanks