title: How to do Sum Operation in SQl Pivot Query
body: <p>Here i have a simple table Name Cust With CustName,PurshaseItem,Price.I wrote a Simple PIVOT query its Pivoting the data but i wana to show sum of the amot
  Here i need Grand  total</p>
  
  <p><strong>Pivot Query</strong></p>
  
  <pre><code>[![select custName,
  
         \[Shoes\] as Shoes,
         \[Colgate\] as Colgate,
         \[Cloths\] as Cloths
  
  FROM
  (select custName,Price,PurchaseItem FROM Cust
  ) AS PIVOTData
  
  PIVOT(
  sum(Price) FOR PurchaseItem 
  IN (Shoes,Colgate,Cloths)
  )AS PIVOTING][1]][1]
  
  
  custname       Shoes    Colgate       GrandTotal
  xyz           12         10           22
  lmn            1          2            3
  </code></pre>