rows to columns query

G

Guest

Dear all, looking for some suggestions/help ...
I am trying to create a time-table data base for school
I have a years table, periods table, days table, teachers
table and subjects table
I am trying to design a query that would produce teachers' time-
tables and what I am coming up with -

SELECT Years.Year, [Days and Periods].Day,
[Days and Periods].Period, Teachers.Teacher,
[Time Table Subjects].TTSubject
FROM (([Days and Periods] INNER JOIN
Teachers ON [Days and Periods].TeacherId = Teachers.TeacherId)
INNER JOIN [Time Table Subjects]
ON [Days and Periods].TTSubjectId = [Time Table Subjects].TTSubjectId)
INNER JOIN Years ON [Days and Periods].YearId = Years.YearId
WHERE (((Years.Year)=[enter year]));

produces the following

year day period teache subject
2004 1 1 jdoe subj
2004 1 2 jdoe subj
2004 1 3 jdoe subj
....

What I am trying to get is the the following
details

year teacher period day1 day2 day3 day...
2004 jdoe 1 subj subj subj
2004 jdoe 2 subj subj subj
2004 jdoe 3 subj subj subj

I have considered a cross tab but I do not want totals
Is there anyway to accomplish this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top