title: Very simple pivot in PostgreSQL
body: <p>I have some data which describes wider data sets. It's given in the format of three columns; fields, field type, notes. Each row is then one of the fields. What i want to do is pivot the first column so that the rows becomes columns into which i will load the data. I've been looking at the create table function using crosstab but the output just reorders my rows so far I've tried;</p>
  
  <pre><code>SELECT * 
  FROM crosstab( 'select field, fieldtype, notes FROM 
  databasestructure order by 1,2') 
  AS final_result(field TEXT, fieldtype text,notes text);'
  </code></pre>