Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab Queries -standarize column headings

Status
Not open for further replies.

ATHConsulting

Programmer
May 8, 2003
4
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top