Getting the syntax right for MySQL select with inner join
Yes, problem one is that you are mixing explicit (SQL-92) JOIN syntax with implicit join, , (SQL-89) comma syntax. While this is allowed and with some care it may even work correctly, it's very easy to get this type of errors.

The FROM part of your query:

from courses as co , course_type as ct 
left join course_leaders as cl 
    on cl.course_leaders_id = co.course_leaders_id1
left join course_links_to_innstyle as cli 
    on cli.course_links_to_innstyle_id = co.course_links_to_innstyle_id 


is parsed as:

from 
    courses as co 
  ,                        -- &lt;-- that acts as a CROSS JOIN
    (
        (
            course_type as ct 
        left join 
            course_leaders as cl 
        on 
            cl.course_leaders_id = co.course_leaders_id1
        )
    left join 
        course_links_to_innstyle as cli 
    on 
        cli.course_links_to_innstyle_id = co.course_links_to_innstyle_id 
    )


Now it's clear that inside the parentheses, co is not defined.



Problem two is that there is no joining condition for ct. You have 4 tables but only 2 (and not 3) joining conditions. This is either something you missed or the intention of the query is to do a CROSS JOIN.



Solution:


It's better to use explicit JOIN syntax everywhere and not mix the two (syntaxes).
Fix the code by either adding the missing condition or use CROSS JOIN if that is the intention of the query.