我想在CakePHP中写下以下内容:
(select email
from membersdatabase
where memberid not in
(select memberid from deregisteredmembers)
答案 0 :(得分:0)
从membersdatabase模型中,编写以下查询:
$options = array(
'conditions' => array('deregisteredmembers.memberid is null'),
'joins' => array(
array(
'alias' => 'deregisteredmembers',
'table' => 'deregisteredmembers',
'type' => 'LEFT',
'conditions' => array(
'deregisteredmembers.memberid = membersdatabase.id',
),
)
),
'fields' => array('membersdatabase.email')
);
$this->find('all',$options);
您将获得所需的结果