mardi 3 février 2015

Postgresql adding fields to view from select (transpose fields)


I've got a table with following structure:



CREATE TABLE test
(
id integer,
field character varying,
value character varying
);

field value
------ -----
field1 value1
field2 value2
field3 value3
... ...


What i need is to traspose the field value as the fields in a view and the value of the field with be the "value" field's value. Example of what i need:



field1 field2 field3 ...
------ ----- ------ ----
value1 value2 value3 ...


I have no idea on how to start building the create view statement.


Regards,





Aucun commentaire:

Enregistrer un commentaire