Welcome Guest, Not a member yet? Register   Sign In
Join Logic
#7

[eluser]ibnclaudius[/eluser]
Thanks weboap, helped a lot, could you please explain you code for me?

Here is the final, working:

Code:
$query = $this->db->select($this->_table['events'] . '.id, ' . $this->_table['events'] . '.title, ' . $this->_table['events'] . '.date, ' . $this->_table['users'] . '.username AS user_username, ' . $this->_table['colleges'] . '.username AS college_username', FALSE)
        ->join($this->_table['events'], $this->_table['events'] . '.college_id = ' . $this->_table['events'] . '.college_id')
        ->join($this->_table['colleges'], $this->_table['colleges'] . '.id = ' . $this->_table['events'] . '.college_id AND ' . $this->_table['colleges'] . '.id = ' . $this->_table['users_colleges'] . '.college_id', 'INNER')
         ->join($this->_table['users'], $this->_table['users'] . '.id = ' . $this->_table['events'] . '.user_id', 'INNER')
        ->where($this->_table['users_colleges'] . '.user_id', $user_id)
        ->get($this->_table['users_colleges']);


Messages In This Thread
Join Logic - by El Forum - 05-23-2012, 02:24 PM
Join Logic - by El Forum - 05-23-2012, 03:36 PM
Join Logic - by El Forum - 05-23-2012, 03:37 PM
Join Logic - by El Forum - 05-23-2012, 04:00 PM
Join Logic - by El Forum - 05-23-2012, 05:46 PM
Join Logic - by El Forum - 05-23-2012, 06:32 PM
Join Logic - by El Forum - 05-23-2012, 06:45 PM
Join Logic - by El Forum - 05-23-2012, 07:05 PM
Join Logic - by El Forum - 05-23-2012, 07:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB