如何在cakephp连接数组中写入顺序和限制

如何在cakephp连接数组中写入顺序和限制,cakephp,join,limit,Cakephp,Join,Limit,我加入cakephp如下: $emp = $this->EmployeePersonal ->find( 'all', array( 'fields' => array('EmployeePersonal.*', 'PermanentDist.name','PresentDist.name','EmployeePosting.*','Designation.name','Department.name','Of

我加入cakephp如下:

$emp = $this->EmployeePersonal ->find(
          'all',
          array(
              'fields' => array('EmployeePersonal.*', 'PermanentDist.name','PresentDist.name','EmployeePosting.*','Designation.name','Department.name','Office.name' ),
              'conditions' => $condition,
              'order' => array('Designation.id'),
              'recursive' => -1,
              'joins' => array(
                          array(
                                   .................
                                   .................
                           ),

                   array(
                      'table' => 'employee_postings',
                      'alias' => 'EmployeePosting',
                      'type' => 'LEFT',
                      'order' => 'EmployeePosting.posting_from DESC',
                      'limit' => 1,
                      'conditions' => array(
                          'EmployeePosting.employee_personal_id = EmployeePersonal.id',
                      )
                  ),
              )
          )
);
但是台词

'order' => 'EmployeePosting.posting_from DESC',
'limit' => 1,

你不工作了!这意味着,虽然我希望从value中获得最后一个最新的
posting\u,但我得到了所有的值!我哪里做错了?我想我把
订单
限制
写错了地方。

要从
获取最后一个最新的
帖子,你必须使用
'groupby'=>'employee\u personal\u id'
而不是
'limit'=>1'
'order'=>'EmployeePosting\u from DESC/code>在同一个数组中保持不变。

没有我明白了。你能解释一下吗?我有没有办法从
值中选择最大的
posting\u,而不是limit?虽然现在没有多个输出,但我得到的是
EmployeePosting.posting的最低值的结果。我添加了
'order'=>'EmployeePosting.posting_from DESC',
无法通过
查找
完成。使用
查询
方法