[SQL Server] Row to Column Trasposition

  • Good evening everybody,

    i've a particular request for U: i've to "traspose" (i'm not sure it's the rigth word) a set of row in a table as a set of column in another table. Maybe an example is the better way to understand:

    TAB1

    FIELD1 FIELD2 FIELD3

    AAA1   BBB1    CCC1

    AAA2   BBB2    CCC2

    TAB2

    FIELD1

    XXX1

    XXX2

    The Resulted table wil be

    RES_TAB

    FIELD1 FIELD2 FIELD3 XXX1 XXX2 

    Thank U

  • Need more Explaination:

    1. whats the key on table1.

    2. are there any other field in table2 to join against table1.

    Here is what I think u have.

    Table1

    -------

    StudentID Name Address

    1111 AAAA  XYZADDRESS

    2222 BBBB  ABCADDRESS

    Table2

    -------

    StudentID Subject Grade

    1111 PHY A 

    1111 CHE B

    2222 PHY C 

    1111 CHE B

    StudentID Name Address PHY CHE

    1111 AAAA  XYZADDRESS  A   B

    2222 BBBB  ABCADDRESS  C   B

     

    Is this what u are looking for?

     

  • Yes, it's the result that I want to obtain.

    Sorry for my incomplete explaination

     

    Walter

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

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