Currently, I have a little problem where I'm expected to build a table that shows the energy generated for the respected days.
I have solved this problem using python with SQL data polling combined with a for loop to look at the energy generated at the beginning of the day to the end of the day and the difference between the two will result in the total energy generated for the particular day. But unfortunately due to the amount of data that's coming out of the SQL database the python function is too slow.
I was wondering if this can be integrated within an SQL query to just spit out a table after it has done the aggregation. I have shown an example below for a better understanding of the table.
SQL TABLE
date/time | value |
---|---|
24/01/2022 2:00 | 2001 |
24/01/2022 4:00 | 2094 |
24/01/2022 14:00 | 3024 |
24/01/2022 17:00 | 4056 |
25/01/2022 2:00 | 4056 |
25/01/2022 4:00 | 4392 |
25/01/2022 17:00 | 5219 |
Final Table From the above table, we can work that the energy generated for 24/01/2022 is 4056(max)-2001(min)= 2055
date | value |
---|---|
24/01/2022 | 2055 |
25/01/2022 | 1163 |