I have 4 tables, i am very confused to select the data.
I have this fields in my 4 tables
t1 -> student_id
given_name
user_name
t2 -> school_year
sem
class
student_id
main_id
t3 -> subject_id
main_id
t4 -> subject_id
subject_name
I need to select (given_name, subject_name, class & main_id). How?
I try like this
SELECT t2.school_year, t2.rp_main_sem, t2.rp_main_class, t4.name, t4.subject_id, t1.given_name, t1.user_name FROM t1, t2, t3, t4 WHERE t2.school_year = 2011 AND t2.sem = 1 AND t2.class = 'ES3A' AND t3.subject_id = t4.subject_id AND t1.student_id = t2.rp_main_student_id