Help with SQL code (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


DesiMcK -> Help with SQL code (4/6/2008 15:40:32)

Hi,

here is my problem. I have a table with four fields: ID, PupilID, Task, Mark

the table has values like this:

1 | Pupil1 | Task1 | Mark
2 | Pupil2 | Task1 | Mark
3 | Pupil3 | Task1 | Mark
etc

11 | Pupil1 | Task2 | Mark
12 | Pupil2 | Task2 | Mark
13 | Pupil3 | Task2 | Mark
etc

and so on.

What I would like is a table that list the pupils done the left and the tasks across the top with the corresponding marks lined up.

_______ Task1 Task2 Task3 etc
Pupil1
Pupil2
Pupil3

Is this possible with asp?

Thanks,

Desi




DesiMcK -> RE: Help with SQL code (4/7/2008 17:31:08)

This is the SQL code that works in Access:

TRANSFORM Avg(tblHomework.Mark) AS AvgOfMark
SELECT tblPupil.PupilID
FROM tblHomework INNER JOIN tblPupil ON tblHomework.PupilID = tblPupil.PupilID
GROUP BY tblPupil.PupilID, tblPupil.FirstName, tblPupil.Surname, tblHomework.ClassID, tblHomework.Task, tblHomework.DateSet, tblHomework.DateDue
PIVOT tblHomework.TaskID

How can I use it in an asp page. I am unsure how to set up the table.

Thanks for all your time and help.

Desi




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875