sam000
asked on
Transposing rows to column in sql server
Hi,
I need a help.
I have a table where the marks are getting inserted.
++++++++++++++++++++++++++ +
RollNo | PaperCode | Marks
++++++++++++++++++++++++++ +
A | 1 |45
A | 2 |26
A | 4 |30
B | 2 |98
B | 3 |58
I want the result in a table in this way:
++++++++++++++++++++++++++ +
RollNo | 1 |2 |3 |4
++++++++++++++++++++++++++ +
A | 45 |26 | 0 |30
B | 0 |98 |58 |0
Please help me how can I do like this.
Regards,
Smaranika
I need a help.
I have a table where the marks are getting inserted.
++++++++++++++++++++++++++
RollNo | PaperCode | Marks
++++++++++++++++++++++++++
A | 1 |45
A | 2 |26
A | 4 |30
B | 2 |98
B | 3 |58
I want the result in a table in this way:
++++++++++++++++++++++++++
RollNo | 1 |2 |3 |4
++++++++++++++++++++++++++
A | 45 |26 | 0 |30
B | 0 |98 |58 |0
Please help me how can I do like this.
Regards,
Smaranika
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
nice reply
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/