mysql Inner joins or sub-querys, syntax help needed
Posted: Thu Apr 15, 2010 5:39 pm
ok i have this query which is working that select data from 3 tables
SELECT user_id, matric_no, course_id, name, email, supervisor, project_id, status FROM (jos_main_students LEFT JOIN jos_users ON user_id = jos_users.id) LEFT JOIN jos_main_allocations ON student_id = jos_users.id;
However course_id is the PK of another table called _main_course and id like to select a field called title from _main_course and have the title of the course display in place of just its course_id.
SELECT user_id, matric_no, course_id, name, email, supervisor, project_id, status FROM (jos_main_students LEFT JOIN jos_users ON user_id = jos_users.id) LEFT JOIN jos_main_allocations ON student_id = jos_users.id;
However course_id is the PK of another table called _main_course and id like to select a field called title from _main_course and have the title of the course display in place of just its course_id.