ATHConsulting
Programmer
I am trying to write a crosstab query where I can rename the column headings to student1-10 from a dynamic answer of the actual names of students, so that when the query is run for different areas the column headings and the values are set for the the reporting. This is what I have so far but it won't work:
[TRANSFORM sum(qryOnLineLogsbySitebyDiag_core.countSt1) AS SumOfcountSt1]
[SELECT qryOnLineLogsbySitebyDiag_core.GraduationYear], [qryOnLineLogsbySitebyDiag_core.SiteName], [qryOnLineLogsbySitebyDiag_core.Discipline], [qryOnLineLogsbySitebyDiag_core.ServiceType], [qryOnLineLogsbySitebyDiag_core.PrimDiagnosis], [Sum(qryOnLineLogsbySitebyDiag_core.countSt1) AS TotDiag]
[FROM qryOnLineLogsbySitebyDiag_core]
[GROUP BY qryOnLineLogsbySitebyDiag_core.GraduationYear], [qryOnLineLogsbySitebyDiag_core.SiteName], [qryOnLineLogsbySitebyDiag_core.Discipline], [qryOnLineLogsbySitebyDiag_core.ServiceType], [qryOnLineLogsbySitebyDiag_core.PrimDiagnosis]
[PIVOT qryOnLineLogsbySitebyDiag_core.StudentName IN "St1", "ST2", "St3", "ST4", "ST5"," ST6", "ST7","ST8","ST9"," ST10";]
With this I get a transform error statement. When I take off the Pivot IN statement it works but shows the actual studentnames. When I change it to Pivot AS then I get the headings but not the counts of diaganosis. Make sense? Please help if possible.
[TRANSFORM sum(qryOnLineLogsbySitebyDiag_core.countSt1) AS SumOfcountSt1]
[SELECT qryOnLineLogsbySitebyDiag_core.GraduationYear], [qryOnLineLogsbySitebyDiag_core.SiteName], [qryOnLineLogsbySitebyDiag_core.Discipline], [qryOnLineLogsbySitebyDiag_core.ServiceType], [qryOnLineLogsbySitebyDiag_core.PrimDiagnosis], [Sum(qryOnLineLogsbySitebyDiag_core.countSt1) AS TotDiag]
[FROM qryOnLineLogsbySitebyDiag_core]
[GROUP BY qryOnLineLogsbySitebyDiag_core.GraduationYear], [qryOnLineLogsbySitebyDiag_core.SiteName], [qryOnLineLogsbySitebyDiag_core.Discipline], [qryOnLineLogsbySitebyDiag_core.ServiceType], [qryOnLineLogsbySitebyDiag_core.PrimDiagnosis]
[PIVOT qryOnLineLogsbySitebyDiag_core.StudentName IN "St1", "ST2", "St3", "ST4", "ST5"," ST6", "ST7","ST8","ST9"," ST10";]
With this I get a transform error statement. When I take off the Pivot IN statement it works but shows the actual studentnames. When I change it to Pivot AS then I get the headings but not the counts of diaganosis. Make sense? Please help if possible.