我有一个名为“Interestslogs”的表,模型的名称是 Interestlog。
我需要根据 Cakephp 中那个表的 id 获取 client_id。
$client_id = $this->Interestslog->find('first',array(
'conditions' => array('Interestslogs.id' => $id),
'fields' => array('Interestslogs.client_id'),
)
);
但是我收到数据库错误:
Database Error
错误:SQLSTATE [42S22]:未找到列:1054“字段列表”中的未知列“Interestslogs.interest_id”
SQL 查询:选择Interestslogs。interest_id从efa。interestslogs如左Interestslog加入efa。interestsAS InterestON ( Interestslog. interest_id= Interest. id) 左连接efa。在(. = . )clients哪里。= 1 限制 1ClientInterestslogclient_idClientidInterestslogsid