Is it possible to convert multiple rows to a single column?

Jun 13 2015 12:09 AM

Is it possible to convert multiple rows to single column?
For Ex,
I have table like this,
       id   name  subname   marks
        1   abc    C         10
        1   abc    JAVA      20
        1   abc    DAA       30
        2   xyz    C         30
        2   xyz    JAVA      20
        2   xyz    DAA       10
          In this case the rows should converted into columns and the subname should come only once as column in the table like this.

       id  name   C      JAVA     DAA
        1   abc  10       20       30
        2   xyz  30       20       10
            Is it possible? If possible please help me....
 


Answers (3)