MySQL query Woes - joining data from two or more tables

Associate
Joined
8 Oct 2003
Posts
48
im creating a quick form that retrieves a list of schedules based on the course

http://www.interquad.com/search/scheduleSelector.asp


now within my Mysql database i have the following simple tables

Course: CourseID,CourseName,TeacherID,coursefee,max

Enrollment:StudentID,CourseID

Students:StudentID,Firstname,Surname,BirthDate

Teachers:TeacherID,FirstName,Surname


my approach was to create a new table called course_schedule so that i can use it to create a start_date,location,num_enrolled.


can anyone please help me as to how i can approach this in order to achieve the form shown on http://www.interquad.com/search/scheduleSelector.asp

thank you

From a Desparate Newbie!
 
africanshox said:
my approach was to create a new table called course_schedule so that i can use it to create a start_date,location,num_enrolled.


can anyone please help me as to how i can approach this in order to achieve the form shown on http://www.interquad.com/search/scheduleSelector.asp

thank you

From a Desparate Newbie!

I'm not sure I understand your question (my response is actually based on your thread title), but this should help:

Code:
SELECT *
FROM `Course`
JOIN `Teachers` ON `Course`.TeacherID = `Teachers`.TeacherID 
JOIN `Enrollment` ON `Course`.CourseID = `Enrollment`.CourseID  
JOIN `Students` ON `Enrollment`.StudentsID = `Students`.StudentsID
 
Back
Top Bottom