How to convert row values to column values in Sql Server 2000

  • I have a table like as below:

    RIC | CHAINS

    ------ | ---------

    ABCDEFG= | 0#ABC1YEJTY

    ABCDEFG= | 0#ABC2YEJTY

    ABCDEFG= | 0#ABC3YEJTY

    HIJKLMN= | 0#DEG1YGHRU

    HIJKLMN= | 0#DEG2YGHRU

    HIJKLMN= | 0#DEG3YGHRU

    From the above, it is clear that the values in the RIC column is repeating. So I want the result to be displayed as follows:

    ABCDEFG= |HIJKLMN=

    ------------ | ------------

    0#ABC1YEJTY | 0#DEG1YGHRU

    0#ABC2YEJTY | 0#DEG2YGHRU

    0#ABC3YEJTY | 0#DEG3YGHRU

    How can I achieve this in Sql Server 2000? In Sql Server 2005/2008 I can use PIVOT clause, but not in 2000.

    I tried using COALESCE, but not getting the result effectively. Any help would be appreciated.

    Thanks

    Rajaraman

  • Take a look at the article in my signature on cross tabs / pivots.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

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

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