Sql Server Query Problem

  • Hi

    I have following data in a table

    ColA ColB ColC ColD ColE (Column Header)

    1      NE   A     CM    5

    2      NE   A     MU    7 

    3      NE   A     NO    9

    I want to write a query which returns me resultset like this

    ColB ColC ColD ColE ColD ColE ColD ColE (Column Header)

    NE   A     CM   5     MU   7     NO    9

    can any body tell me, what will be the query for this result set.

    Regards

    Mahesh

  • your task text violates the rule by which a table [your output table in this case] must have columns with unique names. U have ColD repeated twice. U need to re-think the task to make it consistent with DB design rules.

  • you might be able to achieve this result using PIVOT feature in SQL 2K5. Have a look in BOL. Ofcourse, column names should be unique.

  • Or doit at client side!


    * Noel

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

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