MySQL Forums
Forum List  »  General

Re: Downsampliing data, but define interval start time?
Posted by: Martin Weil
Date: May 06, 2022 08:36AM

Thank you for your reply.

But I don't know if I understood that correctly, so I try to give a better example (and then maybe you can elaborate in more detail what you meant?):

Let's say I have only the following entries in my DB:

datetime | value1
00:00:00 | 1
00:30:00 | 2
01:00:00 | 3
01:30:00 | 4
02:00:00 | 5
02:30:00 | 6
03:00:00 | 7
03:30:00 | 8
04:00:00 | 9
04:30:00 | 10
05:00:00 | 11

With my former approach it would calculate 3 "bins":
- 00:00:00 to 01:59:59 with SUM 1+2+3+4 = 10
- 02:00:00 to 03:59:59 with SUM 5+6+7+8 = 26
- 04:00:00 to 05:59:59 with SUM 9+10+11 = 30

But I would need those "bins":
- 00:30:00 to 2:29:59 with SUM 2+3+4+5 = 14
- 02:30:00 to 4:29:59 with SUM 6+7+8+9 = 30
- 04:30:00 to 6:29:59 with SUM 10+11 = 21


I don't understand how relabelling would help me here. I THINK you meant that I should select my data (beginning from 0:30) with the INNER query and then somehow do my calculations on this data from an outer query, correct?

Would you please be so kind as to elaborate a little more?
Thank you :-)

Options: ReplyQuote


Subject
Written By
Posted
Re: Downsampliing data, but define interval start time?
May 06, 2022 08:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.