How i can use Pivot Operator?

Total Post:9

 479  View(s)
Rate this:
I have a table saller that have following record..

How i can use Pivot Operator?

and i want a query that give  the total ProductSale result  with respect to Name Colmn Like this...
       City                       Rahul               Mohit           Thakur
  Allahabad              300                       200               500
 Jhunsi                       something...
 Phaphamau           something..........

if i use group by keyword then it not give the correct result...please help..

  1. Post:13

    Re: How i can use Pivot Operator?

    Hi Niraj  you check following query by using Pivot operator it produced same output that you are aspects..

         select *from Saller
         sum(ProductSale) for Name in([Rahul],[Mohit],[Thakur])

         )as Pivottable

    output is:

    best of luck...