Having a table with 3 columns as Following:
Original data look like:
I am trying to convert the table into hourly data by suming Energy values. I used this command but got an error => invalid entry syntax for double precision type: "Null":
SELECT lclid, date_trunc('hour', tstp) AS HOUR, COALESCE(SUM(CAST(energy as double precision))
FROM halfhourly
WHERE energy IS NOT NULL
GROUP BY lclid, HOUR;
I have been looking for a while but cannot find the solution. Please help!