获得以上输出我在上面的查询中所做的更改是什么。My Query as followsselect Faculty,STUFF((select ','+ ltrim(rtrim([Course])) +'-S'+ltrim(rtrim([Session])) from Tb_Sch_Time_Table schwhere sch.Schdate = sch1.Schdate and sch.Faculty = sch1.FacultyFOR XML PATH('')),1,1,'')+')' as Schedule from Tb_Sch_Time_Table sch1group by schdate,Faculty I put the above query in view as follows select distinct faculty,stuff((select ',' + schedule as Msg from Vw_Presea_Sch_Send_SMS vw1 where vw1.faculty = vw2.faculty FOR XML PATH('')),1,6,'') as msgfrom Vw_Presea_Sch_Send_SMS vw2Views name is Vw_Presea_Sch_Send_SMSWhen i execute the above query output as followsAug 26 (B Tech 1-S3,B Tech 1-S4)<msg>,Aug 28 (ETO-S3,ETO-S4) But i want the correct output as follows Aug 26 (B Tech 1-S3,B Tech 1-S4) Aug 28 (ETO-S3,ETO-S4)for that getting a above output what is the changes i have to made in above query.推荐答案更改来自Change Fromselect distinct faculty,stuff((select ',' + schedule as Msg from Vw_Presea_Sch_Send_SMS vw1 where vw1.faculty = vw2.faculty FOR XML PATH('')),1,6,'') as msgfrom Vw_Presea_Sch_Send_SMS vw2 要Toselect distinct faculty,stuff((select ' ' + schedule from Vw_Presea_Sch_Send_SMS vw1 where vw1.faculty = vw2.faculty FOR XML PATH('')),1,0,'') as MSGfrom Vw_Presea_Sch_Send_SMS vw2 希望这有助于Hope this helps 这篇关于我试过了我最好但我无法获得我的例外输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 23:39