Welcome Guest, Not a member yet? Register   Sign In
problem with mysql join
#1

[eluser]bhbutter123[/eluser]
I have two tables, for the most part the joins I am performing are working great but one column is the same in both tables - the id column which is the primary key. When I join the two tables the id from one is overwriting the id from the other one. Here is my model's code:

function get(){
$this->db->select('*');
$this->db->from('ci_businesses');
$this->db->join('ci_users', 'ci_users.id=ci_businesses.owner_id');
$query = $this->db->get();
$result = array();
foreach($query->result_array() as $row){
$result['listings'][] = $row;
}
return $result;
}
Is there something I am doing wrong or something I can add to have both id columns kept?


Messages In This Thread
problem with mysql join - by El Forum - 12-15-2009, 12:14 PM
problem with mysql join - by El Forum - 12-15-2009, 12:24 PM
problem with mysql join - by El Forum - 12-15-2009, 12:37 PM
problem with mysql join - by El Forum - 12-15-2009, 12:44 PM
problem with mysql join - by El Forum - 12-15-2009, 02:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB