crosstab in PostgreSQL

I have the following tables: CREATE TABLE sensor ( id int PRIMARY KEY, abbrv varchar(255) NOT NULL UNIQUE ); and CREATE TABLE readings ( time timestamp without time zone NOT NULL, device_id int NOT NULL, sensor_id int REFERENCES sensor (id) NOT NULL, value float4 NOT NULL ); How can I query the database so that it returns the table time | device_id | abbrv $1 | … | abbrv $n where n ranges over the rows of the table sensor and ‘abbrv $i’ is replaced by the corresponding value in…

Read More