I am trying to consolidate a MySQL table in python based on same values in one of the columns.
In the example below I am basically trying to sum-up the values in column "price" for all rows with equal values in column "id", while dropping column "unique_number".
Column "time" will always have the same values in all rows with the same values in column "id". Here it would be sufficient to either take the first occurance in "time" or perhaps calculate an average (would always be the same).
INPUT
OUTPUT
For example: the first two rows have the same value of "123" in column "id". Here I am trying to calculate the sum, which is 210.79. The "time" for both is the same (since the IDs are the same).
Can anyone help?
Thanks in advance
SELECT TIME, ID, SUM(VALUE)
FROM TABLE
GROUP BY TIME, ID