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
769k
I want the mutiple row output in single row using sql server
Aug 25 2014 3:19 AM
Query as follows
select Faculty,Convert(char(7),sch1.[Schdate],100 )+'('+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
order by 1
When i run the above the query output as follows
Faculty Schedule
CPG Aug 26 (B Tech 1-S3,B Tech 1-S4)
CPG Aug 28 (ETO-S3,ETO-S4)
i want the Aug28 date in first row not in second row.
But i want the output as follows
Faculty Schedule
CPG Aug26(B Tech 1-S3,B Tech 1-S4) Aug28(ETO -S3,ETO -S4)
Reply
Answers (
4
)
sql sercer in keywords
i worked lot but i coluld not the correct output