title: Can the same query be done with Pivot?
body: <p>I have a table as</p>
  
  <pre><code>CREATE TABLE #FinalRates
  (
  id int primary key identity(1,1),
  RateDesc nvarchar(50),
  Amt decimal(18,2)
  )
  
  insert into #FinalRates values('100',200)
  insert into #FinalRates values('100',300)
  insert into #FinalRates values('50-80',100)
  insert into #FinalRates values('50-80',300)
  insert into #FinalRates values('30-50',500)
  insert into #FinalRates values('30-50',250)
  </code></pre>
  
  <p>Looking for an output as </p>
  
  <pre><code>RateDesc    Amount1 Amount2
  100          200    300
  50-80        100    300
  30-50        500    250 
  </code></pre>
  
  <p>I have done this as </p>
  
  <pre><code>;with cte as(
  select 
                  RateDesc 
                  ,Amounts=
                        STUFF((Select ','+ cast(cast(Amt as int) as varchar(10))
                        from #FinalRates T1
                         where T1.RateDesc=T2.RateDesc
                         FOR XML PATH('')),1,1,'') 
  from #FinalRates T2
  group by T2.RateDesc
  )
  
  select 
          RateDesc,
          Amount1 = PARSENAME(REPLACE(Amounts,',','.'),2),
          Amount2 = PARSENAME(REPLACE(Amounts,',','.'),1)
  From Cte
  
  Drop table #FinalRates
  </code></pre>
  
  <p>Can the same be done using PIVOT?</p>