2015-05-21 4 views
0

благодаря помощи, которую я получил в Stackoverflow, изучая php, я могу присоединиться к столам и использовать Count.Подсчет и подсчет таблиц в cakePHP

Я не могу сделать это в одном запросе.

Я хочу считать записи в объединенном столе. Это то, что я судимый и я, кажется, получаю ошибки:

$options = array(
    'fields' => array(
     'toutcome.AffCommission', 
    ), 
    'joins' => array(

     array(
      'conditions' => array(
       'tapplicant.AppID = toutcome.AppID', 
      ), 
      'table' => 'toutcome', 
      'alias' => 'Toutcome', 
      'type' => 'join', 
     ), 
    ), 
    'limit' => 'Toutcome', 
    'offset' => 'Toutcome', 
    'contain' => array(
     'Toutcome', 
    ), 
); 

$data = $this->Tapplicant->find('count', $options); 
$this->set('count', $data); 
+0

Привет @ Miam84, вы думаете, вы могли бы помочь в этом? – MatHatrik

ответ

0

Попробуйте

$options = array(
    'fields' => array(
     'toutcome.AffCommission', 
    ), 
    'joins' => array(

     array(
      'conditions' => array(
       'tapplicant.AppID = toutcome.AppID', 
      ), 
      'table' => 'toutcome', 
      'alias' => 'Toutcome', 
      'type' => 'join', 
     ), 
    ), 
    'limit' => n, // its should be integer 
    'offset' => n, // its should be integer 
    'contain' => array(
     'Toutcome', 
    ), 
); 
Смежные вопросы