title: Transpose rows into column in PostgreSQL
body: <p>Here is my current PostgreSQL query:</p>
  
  <pre><code> SELECT     
          c.ce_new_cat_short, 
          d.ver_desc_txt, 
          c.product_type, 
          round(sum(d.profit_amt/f.exch_rate)::numeric, 2) AS dp_dol, 
          sum(d.unit_qty) AS units
   FROM       
          ext_ce.gsam_v_data_detail as d
          LEFT JOIN
              (SELECT DISTINCT g.prmry_prfl_cd, g.wrkhrs_grp, g.brnd_fmly_desc_txt_adj FROM ext_ce.gsam_v_data_context AS g) AS vc
          ON vc.prmry_prfl_cd = d.prmry_prfl_cd,  
          ext_ce.gsam_data_context as c,
          ext_ce.info_fx_rates_v2 as f
   WHERE      
          c.product_type &lt;&gt; 'SALES AIDS'::text 
          AND c.cncpt_nr::numeric = d.prmry_prfl_cd
          AND f.offr_cmpgn_yr_nr = 2017
          AND d.mrkt_desc_txt = f.mrkt_desc_txt
   GROUP BY   
          c.ce_new_cat_short,  
          d.ver_desc_txt, 
          c.product_type;
  </code></pre>
  
  <p>I'm stuck trying to transpose <code>column ver_desc_txt</code>.</p>
  
  <p>Here is my current output, alongside a desirable one.</p>
  
  <p><a href="https://i.stack.imgur.com/crYd2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/crYd2.png" alt="Current and desired output"></a></p>
  
  <p>How can I adjust this query to get the desirable output?</p>