Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server
date	        sess    code   course
14-Jan-13	 1	CM	AFF
14-Jan-13	 3	CM	AFF
17-Jan-13	 1	NR	CTF
 

 
from the above i want the output as follows;
 

                    AFF (course)				
	      1   2    3   4  (sess)
 14-Jan-13    CM      CM
 
                    CTF     (course)				
	     1    2  3  4   (sess)
 17-Jan-13   NR
 

for getting a above output i tried the query as follows; but output is not getting;
query as follows;
 
SELECT *
FROM (
SELECT *
FROM [Tb_SCh_TIme_Table])
PIVOT(MAX([faculty_code])FOR [session] IN ([1],[2],[3] ,[4])) AS PVT
 
i tired the above query when i run shows error as follows;
 
Line 5: Incorrect syntax near '('.
from my above query what is the mistake please help me.
 

[edit]Code block added (not that the original indentation makes it a lot clearer) - OriginalGriff[/edit]
Posted 19-Jan-13 20:35pm
Edited 19-Jan-13 22:20pm
v2
Comments
Sandeep Mewara at 20-Jan-13 6:34am
   
Follow at one place: http://www.codeproject.com/Questions/530591/Ipluswantplustheplusoutputplusasplusfollowsplusinp

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This is the third time you have posted this same question (see I want to secreate course wise report in datagridview in c sharp .net.[^]). Please do not repost the same issue but edit your original if you have extra information to show.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 645
1 Maciej Los 225
2 Abhinav S 171
3 Richard Deeming 160
4 Suvendu Shekhar Giri 159
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 9,135
2 Peter Leow 5,042
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,581


Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 20 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100