mercredi 4 février 2015

Add 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
... ...


I need to transpose 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.





Aucun commentaire:

Enregistrer un commentaire