I'm trying to create a query through Postgres. I have a table like this:
Date----------|Meter-----|------period-----|-----value
2017-05-23-----meter1 ---------- 1 ------------ 2.01
2017-05-23-----meter1 ---------- 3 ------------ 4.01
2017-05-23-----meter1 ---------- 4 ------------ 0.00
The table represents meter readings. There needs to be 48x meter readings per day. However sometimes for some reason a meter reading may not come through so there will be no record. Also, a meter reading could be 0.00.
What I need to do is generate a series that gives me something like this if I search for meter readings for any given meter on a particular date:
Period----Total
1 --- 2.01
2 --- null
3 --- 4.01
4 --- 0.00
.
.
.
It needs to give me 48 readings even if there is no record. I'm trying to populate a google graph from a JSON response and the graph accepts null values but not 'no' values.
I appreciate any help.