Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Pivot rows to columns dynamically

$
0
0

I want to convert row data into columnsdynamically.

Reg no      Title                   Marks     
10900231    Asgn 1             10.00        
10900231    Asgn 3             5.00         
10900231    P4                   75.00        
10900231    P5                   65.00        
10900231    P6                   80.00        
10900231    P7                   80.00        
10900232    Asgn 1            12.00        
10900232    Asgn 2            13.00        
10900232    Asgn 3            5.00         
10900232    P4                  75.00        
10900232    P5                  65.00        
10900232    P6                  80.00        
10900232    P7                  80.00      

.....................  

I want to result in following format todynamically

Reg NO         Asgn 1       Asgn 2     Asgn 3 P4   P5   P6   P7    
10900231       10           10         5      75   65   80  80    
10900232       12           13         5      75   65   80  80


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>