How to Pivot on a column which may have various counts per row

  • I have data like the following format:

    caseID Code

    1 AAA

    1 BBB

    1 CCC

    1 DDD

    2 CCC

    3 AAA

    3 BBB

    3 CCC

    3 DDD

    3 EEE

    I want to pivot it so that it displays as such:

    CaseID Code1 Code2 Code3 Code4 Code5

    1 AAA BBB CCC DDD

    2 CCC

    3 AAA BBB CCC DDD EEE

    How can I do this? I was trying to use the Pivot Transform in ssis but it seems to need an aggregate.

  • Please don't cross post.

    further discussions please on thread http://www.sqlservercentral.com/Forums/FindPost723433.aspx



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

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