Convert Rows to Columns Pivot

  • [font="Courier New"]

    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

    [/font]

  • Take a look at these articles:

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

    Luis C.
    General Disclaimer:
    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?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (10/19/2012)


    Take a look at these articles:

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

    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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Good articles helped a lot thanks

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply