Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 29th, 2004, 05:42 AM
ruggie_uk ruggie_uk is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 2 ruggie_uk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old January 30th, 2004, 08:32 AM
ruggie_uk ruggie_uk is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 2 ruggie_uk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Build results grid


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT