I have a table called 'Interestslogs' and model's name is Interestlog.
I need to get the client_id according to id from that table in Cakephp.
$client_id = $this->Interestslog->find('first',array(
'conditions' => array('Interestslogs.id' => $id),
'fields' => array('Interestslogs.client_id'),
)
);
However I am getting database error:
Database Error
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Interestslogs.interest_id' in 'field list'
SQL Query: SELECT Interestslogs.interest_id FROM efa.interestslogs AS Interestslog LEFT JOIN efa.interests AS Interest ON (Interestslog.interest_id = Interest.id) LEFT JOIN efa.clients AS Client ON (Interestslog.client_id = Client.id) WHERE Interestslogs.id = 1 LIMIT 1
Interestslogtable contains the fieldinterest_id- thecodeparadox