How to transpose columns to rows

  • Hello everyone,

    I have a task to solve and I need some help.

    Task description:

    There is a table with 2 columns ID and Value which are populated as following

    ID Value

    1 a

    1 b

    1 c

    2 d

    2 e

    3 f

    So I have to represent it as:

    ID Composition

    1 a,b,c

    2 d,e

    3 f

    Any help will be appreciated.

  • The following article will explain how to do it:

    http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    Read it and ask any questions you might have.

    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
  • Dear Luis,

    It works fine!

    Thank you!

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

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