Help with Table Joins

I am trying to join three mysql tables with not much success.

I have three tables:

student
--------
id
school
teacher

--------
school
--------
id
school_name

--------
teacher
--------
id
teacher_name

I thought that something like this would work:

SELECT *
    FROM student AS stu
    INNER JOIN
        school AS sch on (stu.school = sch.id)
    INNER JOIN
        teacher AS tea on (stu.teacher = tea.id)

The first inner join works but as soon as I add the second join the server connect output only shows the first record.

Community Page
Last updated: