如何将数据合并到一列?

时间:2016-04-14 08:31:56

标签: sql sql-server join

这是我的查询

 select t.tourID,s.studentID,s.studentDOB,s.studentAddress,ta.teacherName 
 from Student s 
 join Tour_studentlist ts on s.studentID=ts.studentID
 join Tour_teacherlist tt on tt.tourID = ts.tourID
 join Tour t on t.tourID =ts.tourID
 join Coach c on c.coachID = t.coachID
 join Teacher ta on ta.teacherID=tt.teacherID
 where ts.tourID=ts.tourID
 GROUP BY t.tourID , s.studentID,s.studentDOB,s.studentAddress,ta.teacherName ;

输出表:Output

如何将教师姓名数据合并为1? 例如。

TourID|studentID|studentDOb|studentAddress|teacherName
1     |1        |1999-01-10|No.15....     |Jessica,Lucy,Victoria|

0 个答案:

没有答案