Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I am having this table.

Name       RollNo       Date         Forenoon      Afternoon

Ravi        101       01/07/2012     Present        Present

Ravi        101       01/08/2012     Present        Absent

Ravi        101       01/09/2012     Present        Present


I need This output
Name      RollNo          01/07/2012           01/08/2012              01/09/2012 

                       Forenoon Afternoon    Forenoon Afternoon    Forenoon Afternoon

Ravi       101         Present   Present      Present   Absent      Present   Present
Posted
Updated 12-Jan-12 1:28am
v3

Have you tried to use the PIVOT clause in the SQL statement?

This link http://sqlserver2000.databases.aspfaq.com/how-do-i-create-a-cross-tab-or-pivot-query.html[^] provides a bit more info...

HTH
 
Share this answer
 
Comments
Chocka_11 13-Jan-12 1:26am    
ya i have tried that, but still not getting that sub columns (forenoon,Afternoon)
Try this PIVOT[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900