March 22, 2013 at 4:28 am
SELECT S.UniversityNo
,S.Name
,U.SSubjectCode
,U.IsPass
FROM SStudentUnivPerformamce U
INNER JOIN SStudent S oN U.SStudentID = S.StudentID
INNER JOIN SSubject SU ON U.SSubjectID = SU.SSubjectID
WHERE U.SBatchID = 4
GROUP BY S.UniversityNo
,S.Name
,U.SSubjectID
,U.SSubjectCode
,SU.Descriptions
,U.IsPass
ORDER BY S.UniversityNo,U.SSubjectID
I want the Output Like This
-------------------------------------------------------------------------
UniversityNo Name Sub1 Sub2 Sub3 ......
-------------------------------------------------------------------------
123 Raja P F P ....
124 Kumar P F P ....
125 Ravi P F P ....
126 Raji P F P ....
March 22, 2013 at 7:53 am
Please take a few minutes to read the first article in my signature about best practices when posting questions. We need to see ddl, sample data and desired output.
If you don't want any specific coding help and want to figure it out on your own, the best approach here is to use FOR XML.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply