title: Convert row to column in SQL Server does not work?
body: <pre><code>period  providerid  type    volume     subscribers
  --------------------------------------------------
  Aug-2016    7        1      4027917    117172
  Aug-2016    7        2      5325430    232293
  Aug-2016    7        3      8722165    236472
  Jul-2016    7        1      2981655     97409
  Jul-2016    7        2      6449570    147315
  Jul-2016    7        3      7702484    206140
  </code></pre>
  
  <p>I want my result in this format.</p>
  
  <pre><code>period      providerid  SMS     Data    minutes
  Aug-2016    7           432142  42342   5454
  Jul-2016    7           5454    5454    545
  </code></pre>
  
  <p>I have tried this query but it does not work.</p>
  
  <pre><code>select   
      period, providerid, 1 as SMS, 2 as Data, 3 as minutes
  from 
      #P         
  pivot
      (sum(volume) for [type] in ([1],[2],[3])) as P
  </code></pre>
  
  <p>Please help me in SQL server</p>