title: How to select data from table to get output in transpose or crosstab manner?
body: <p>I have a table reportdata with below values :</p>
  
  <pre><code> reportdata       memberCount     monthname     year
  Assigned user        588           February     2017
  Assigned user        2             January      2017
  Assigned user        22            May          2017
  FHD                  571           February     2017
  FHD                  15            May          2017
  ICM                  1             May          2017
  sortingCompleted     1             February     2017
  sortingCompleted     2             May          2017
  </code></pre>
  
  <p>I want output like :</p>
  
  <pre><code>   reportdata           January   February      May
      Assigned user           2       588          22
         FHD                  0       571          15
         ICM                  0        0            1
     sortingCompleted         0        1            2
  </code></pre>
  
  <p>I have tried below query :</p>
  
  <pre><code>select d.reportdata,
  CASE WHEN d.monthname='January' THEN d.MemberCount END AS January,
  CASE WHEN d.monthname='February' THEN d.MemberCount END AS February,  
  CASE WHEN d.monthname='May' THEN d.MemberCount END AS May from
  (
  select reportdata, memberCount,monthname
  from cme_report where year='2017'
  ) as d
  </code></pre>
  
  <p>Please suggest the way to get expected output. Thank is advance.</p>