Sno Sch_Date Session Course Faculty_Code
1 1/12/2013 1 AFF GS
2 1/12/2013 1 AFF NR
3 1/13/2013 1 TFc VB
i want the output in ms access database;
for that below how to write sub query and get the below output.
in faculty_code column that GS,NR to be want in the 1/12/2013 date.
for that how to write sub query, convert rows in to columns and put it in to a single column(GS,NR) fro the 1/12/2013 my required output.
Sno Sch_Date Session Course Faculty_Code
1 1/12/2013 1 AFF GS,NR
how can i do.help me.
please reply the answer. i posted question in your site. but some times not updating the answer.
kindly please repay answer for my above question and help me please.
Jignesh TrivediPosted Jan 28, 2013, 11:33 PM
Please try following query..
select ROW_NUMBER() OVER(ORDER BY P.Sch_Date DESC) AS Sno,Sch_Date,Session,Course,(SELECT SUBSTRING(
(SELECT ',' + s.Faculty_Code
FROM #temp s where s.Sch_Date = P.Sch_Date and s.Course = P.Course and s.Session = P.Session
FOR XML PATH('')),2,200000)) AS CSV from #temp P
group by Sch_Date,Session,Course
in this script you may your excepted result.
hope this will help you.