TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
765.7k
i worked lot but i coluld not the correct output
Aug 25 2014 8:59 AM
My Query as follows
select Faculty,STUFF(
(select ','+ ltrim(rtrim([Course])) +'-S'+ltrim(rtrim([Session])) from Tb_Sch_Time_Table sch
where sch.Schdate = sch1.Schdate and sch.Faculty = sch1.Faculty
FOR XML PATH(''))
,1,1,'')+')' as Schedule from Tb_Sch_Time_Table sch1
group 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 msg
from Vw_Presea_Sch_Send_SMS vw2
Views name is Vw_Presea_Sch_Send_SMS
When i execute the above query output as follows
Aug 26 (B Tech 1-S3,B Tech 1-S4)</Msg><Msg>,Aug 28 (ETO-S3,ETO-S4)</Msg>
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 changes i have to made in above query.
Reply
Answers (
2
)
I want the mutiple row output in single row using sql server
Triggers