Postgres interpolate and group

Viewed 25

I want to check my heating gas consumption for this winter. For the recent winters I have only the value of gas meter per 31.03 of each year.

https://dbfiddle.uk/QLN1qtVR

Lets assume my heating Period is from 15.09.2017-31.03.18. So this are 197 and my consumption in this period was 400m3. So I have needed 2,03m3 per day in avg.

What I would like to see is a interpolation and grouping by month. But I dont know really where to start.

As Result I image something like this: result_table

Edit: ok I was playing a bit more. Its a rough way. I create a jsonb column for each row. But I can't calc the values in the json. https://dbfiddle.uk/6wk89Nkj

0 Answers
Related