[H-GEN] SQL query needed

Paul Clarke paul at qfm.org.au
Tue Aug 26 15:37:32 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Hi all,

I am working on a mySQL data base that records student results. The main
tables are along the lines of:

Students = STUDID, name, class
1000, Bill, 5a
1002, Sue, 5a

and 

Results = STUDID, TESTID, result
1000, 1, A
1002, 1, B
1000, 2, B
1002, 2, C

and

Tests = TESTID, description
1, maths1
2, english1

I want to have a query that will return:
STUDID, name, maths1, english1
1000, Bill, A, B
1002, Sue, B, C

What would the query look like? I am programming it all in php so it is
possible to have the query generated to something like "select STUDID,
name, maths1, english1 from ..."

Thanks

Paul

Site Dynamics - Paul Clarke
paul at sitedynamics.com.au
0414 367 747


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list