i have a table like this:
name used time
asd 10 15:00
bsf 15 15:00
asd 20 14:55
bsf 0 14:55
i need to make a query that returns values like this: the result i need for the grafana timeseries is:
total tm
25 15:00
20 14:55
i've tried using:
SELECT
DISTINCT(time) as tm,
sum(used) as total
FROM table
GROUP BY tm
but that doesnt works everything i try gives me the repeated time values
I managed to solve the problem by using the date_trunc() function to select the time value since the column was of type timestamptz the query ended up looking like this
select
date_trunc('minute', time) as tm,
sum(used) as total
from
table
group by
tm