Link to home
Start Free TrialLog in
Avatar of sam000
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
Avatar of jogos
jogos
Flag of Belgium image

ASKER CERTIFIED SOLUTION
Avatar of Lee Wadwell
Lee Wadwell
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sam000
sam000

ASKER

Thanks
Avatar of sam000

ASKER

nice reply