I have searched for days for my unique problem but seem to not find the answer so i decided to post my case here. I have a server that records IOT data for different transformer equipment on an MQQT server. Each equipment has a station, line_name, mw, amp, time(in epoch), hour, minute, seconds, and date. A station has several line_name with different readings for each row, there are several stations with several line_names. The task I have been trying to carry out is to get the average mw on each line_name and return rows with 15 minutes average of each line_name of a station, the server stores a row for each line every 4 or 5 seconds depending on the time the IOT server receives the input. I am not strong at the database end, but I understand some basic queries and this search has made me learn more. Below is one of the query I tried which did not work
SELECT
avg(mw),
station,
generate_series(1646676821000, 1646676841000, 5000) as interval_alias
FROM lines_table
where station='station_name' and line_name='tr1'
GROUP BY interval_alias, station
this didnt work. How can i query a 15 minutes interval average of each line_name mw parameter. Thanks in advance