I have two queries which I want to achieve.
I have a table like so...
Date | Period | Location | Price
2017-01-01 1 A 10
2017-01-01 2 A 15
2017-01-01 1 B 15
2017-01-01 2 B 16
Each date has 48 readings (one every half hour).
Query 1: I wish to get the average prices for any given location within a date range in the following format:
e.g. Between 2017-01-01 and 2017-06-30, average price per period for location 'A'
Period 1 | Period 2| Period 3 ...
10 11 15
Query 2: I wish to have the average price for any given location going back x number of months: (period does not matter)
Month | Average price
january 10
february 12
march 16
Any help would be greatly appreciated :)