reterview data from two tables using inner join in cakephp
- by user3593884
I two tables from database one as
user(id,first_name,last_name) and the second table
location(id,country).
I need to perform inner join with this two tables and the list should display first_name,last_name,country with condition user.id=location.id
I have written sql queries in cakephp
$this->set('users',$this->User->find('list', array(
'fields' => array('User.id', 'User.first_name','location.country'),
array('joins' => array(array('table' => 'location',
'alias' => 'location',
'type' => 'INNER',
'conditions' => array('User.id = location.id')))))));
i get error -Unknown column 'location.country' in 'field list'
Please help!