|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Build results grid
Before I start, forgive me for my ignorance but I am a total novice learning as I go so if I am doing something stupid, please let me know.
I have created a students marking relational database that is accessed via a web frontend on an intranet. I have got a results table (grades) that stores the pupilid,periodid,subjectid,markid for example. I can retrieve results in a grid but they appear like this. Pupil1 - october2003 - math - 1a pupil1 - october2003 - english - 1c pupil2 - october2003 - math - 1a It also does not include pupils with no results yet entered. I did achieve semi success using left join but that wouldn't work with my inner join to link the tables. I would like a grid name - math - english pupil1 - 1a - 1c pupil2 - 1a - 2b I can't paste my exact sql until I get back to the other school (friday)but any general tips in the meantime will be helpful. My current sql is something along the lines of SELECT * FROM tbl_pupils INNER JOIN tbl_grades ON tbl_grades.pupilid = tbl_pupils.pupilid WHERE tbl_pupils.classid = var_class there is also a join to link the periodid to the period name and subject id to subject name. |
|
#2
|
|||
|
|||
|
Thanks to a dreamweaver FAQ I now have got a step further.
<% Dim SQL SQL = "SHAPE {SELECT * FROM tbl_pupils WHERE classID = 'ses_classid' ORDER BY psurname, pforename ASC} " SQL = SQL & " APPEND ({SELECT * FROM tbl_grades INNER JOIN tbl_subject ON tbl_subject.subjectid = tbl_grades.subjectid} AS report " SQL = SQL & " RELATE pupilid TO pupilid)" Dim rsmixed Set rsmixed = Server.CreateObject("ADODB.Recordset") rsmixed.Open SQL, MM_shaping_STRING %> This gives me pupil1 math - 1a english - 1b pupil2 math - 3x english - 2c Any advances greatly appreciated. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Build results grid |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|