skip to Main Content

PostgreSQL: get latest row for each time interval

I have the following table. It is stored as a TimescaleDB hypertable. Data rate is 1 row per second. CREATE TABLE electricity_data ( "time" timestamptz NOT NULL, meter_id integer REFERENCES meters NOT NULL, import_low double precision, import_normal double precision, export_low…

VIEW QUESTION

how can I make result of ARRAY_AGG() function json parsable – Postgresql

I have a query that selects the rows from joined table as an array using ARRAY_AGG() function. select entity_number, ARRAY_AGG('{"property_id":"'||property_id||'","value":"'||value||'"}') entity_properties from entities join entity_properties on entities.id = entity_properties.entity_id where entities.id in ( select entity_id from entity_properties where value =…

VIEW QUESTION
Back To Top
Search