Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sayer
Starting Member
35 Posts |
Posted - 2013-04-19 : 09:04:02
|
i have 30 lecture and every lecture has many studentshow to put lecture in column and students in row such as 1 2 3 4 5 6 7 8 9 <number of lectures | --------------------------------------------- 299 yes no yes no 22 yes no yes no 111 yes no yes no 11 yes no yes no 2223select lesson_number ,date,S.ID_student,dbo.FUN_names(S.frist_Name, S.Second_Name, S.Last_Name) AS namefrom lecture L,student_lectuer SL,Teacher_Course TC,student S,section se , course c ,Supervisor SP,TeachCourse_Super TCSP,teacher twhereL.lesson_number=sl.FK_lesson_number andL.ID_Course_Teacher=TC.idandS.ID_student=sl.fk_student_idandtc.FK_Teacher_ID=t.Teacher_IDandtc.FK_Course_ID=c.Coures_IDandtc.FK_Section_ID=se.Section_IDandtcsp.teacher_coures_ID=tc.idandtcsp.super_id=sp.Super_IDandc.Coures_ID=102--and--se.Section_ID=3please help mehttp://aman-services.netfor office???? ???? ??????? |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-04-19 : 09:17:41
|
I assume the column labels 1,2,3 etc. are lecture numbers. What does the data in column 1 (299, 22 etc.) represent, and what does Yes or No values in the other columns represent? It would be much easier for someone to respond if you post some sample data and table schema in a consumable format. Take a look at this page to see how you might generate such data: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-19 : 09:19:32
|
we can convert columns to rows by using PIVOT.. Post the sample data of your table... and expected output clearly..--Chandu |
|
|
sayer
Starting Member
35 Posts |
Posted - 2013-04-19 : 09:27:21
|
What does the data in column 1 (299, 22 etc.) >>> id student what does Yes or No values in >> state of present & absent in lecturehttp://aman-services.netfor office???? ???? ??????? |
|
|
|
|
|
|
|