Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Convert Rows to Columns Pivot Expand / Collapse
Author
Message
Posted Friday, October 19, 2012 3:41 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, April 22, 2013 3:43 PM
Points: 1, Visits: 12

I have data in a table 
ManagerGoals
EventID EEID CustValue
107 12 JLK
108 12 Manager
109 12 50
107 27 PEN
108 27 Supervisor
109 27 60
107 31 DAV
108 31 Manager
109 31 50

Need it like this
EEID INIT TITLE GOALPERC
12 JLK Manager 50
27 PEN Supervisor 60
31 DAV Manager 50

Could be many more records and goal percent may change each month


Post #1375048
Posted Friday, October 19, 2012 3:54 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 5:42 PM
Points: 3,576, Visits: 8,026
Take a look at these articles:
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs



Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1375049
Posted Friday, October 19, 2012 3:55 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:46 PM
Points: 35,218, Visits: 31,676


Heh... Man! You're fast!.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1375050
Posted Sunday, October 21, 2012 12:21 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 8:53 AM
Points: 201, Visits: 1,149
Good articles helped a lot thanks
Post #1375193
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse