title: Convert columns to row in Postgres
body: <p>My Table name is <code>osk,st,item</code>. osk fields are <code>stid,stock,free,npr,itemno</code>. st fields are <code>stid,name</code>. items fields are <code>id,name</code>. And i have multiple schema. Every schemas have this table</p>
  
  <pre><code>select i.name,st.name,stock,freestock from osk,st,items i where i.id=osk.itemno 
  and st.stid=osk.stid
  </code></pre>
  
  <p>this query return result like this</p>
  
  <pre><code>  Name   St.Name    Stock   FreeStock
     A        B         10        20
     D        B         10        10
     C        E         12        10
  </code></pre>
  
  <p>But I want</p>
  
  <pre><code> Name    B (stock)     B(Free)   E(Stock)  E (Free Stock)
    A        10           20         -           -
    D        10           10         -           -
    C        -            -          12          10
  </code></pre>
  
  <p>How to acheive this. (i have multiple schema. all schemas have this table i want retrive from all schema)</p>
  
  <p>am using <strong>postgresql 9.3</strong>. IF possible to use CrossTab? How to use it?</p>