Welcome Guest, Not a member yet? Register   Sign In
MySQL JOIN
#3

[eluser]ibnclaudius[/eluser]
I tried this:

Code:
$query = $this->db->select($this->students_grades_table . '.grade AS user_grade, ' . $this->subjects_table . '.name AS subject_name')
    ->from($this->subjects_table)
    ->join($this->students_grades_table, $this->students_grades_table . '.subject_id = ' . $this->subjects_table . '.id', 'LEFT')
    ->join($this->classes_table, $this->classes_table . '.id = ' . $this->subjects_table . '.class_id', 'INNER')
    ->where(array($this->classes_table . '.school_id' => $school_id, $this->students_grades_table . '.user_id' => $user_id))
    ->get();

But still returning this:

user_grade | subject_name
————————————-
5 | Math


Messages In This Thread
MySQL JOIN - by El Forum - 02-01-2012, 02:55 PM
MySQL JOIN - by El Forum - 02-01-2012, 03:34 PM
MySQL JOIN - by El Forum - 02-01-2012, 05:29 PM
MySQL JOIN - by El Forum - 02-01-2012, 05:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB