组未在CakePHP中工作
我正在CakePHP中运行以下查询:组未在CakePHP中工作,cakephp,grouping,Cakephp,Grouping,我正在CakePHP中运行以下查询: $options = array('conditions' => array('Patient.' . $this->Patient->primaryKey => $id),array('recursive'=>2,'group'=>array('group_id'))); $this->set('patient', $this->Patient->PatientTest->find('all',
$options = array('conditions' => array('Patient.' . $this->Patient->primaryKey => $id),array('recursive'=>2,'group'=>array('group_id')));
$this->set('patient', $this->Patient->PatientTest->find('all', $options));
但是我的小组
没有按需要工作。它给我的输出如下:
Array
(
[0] => Array
(
[PatientTest] => Array
(
[patient_id] => 2
[test_id] => 1
[date] => 2014-03-27 17:44:17
[result] => 55
[group_id] => 1
)
[Patient] => Array
(
[id] => 2
[name] => Test Patient
[age] => 44
[gender] => 0
[email] => emailid@gmail.com
[contact] => 789654123
[date] => 0000-00-00 00:00:00
)
[Test] => Array
(
[id] => 1
[name] => Hb
[group_id] => 1
[normal] => 12 - 16 gma%
)
[Group] => Array
(
[id] => 1
[name] => Haematology
)
)
[1] => Array
(
[PatientTest] => Array
(
[patient_id] => 2
[test_id] => 2
[date] => 2014-03-27 17:44:17
[result] => 55
[group_id] => 1
)
[Patient] => Array
(
[id] => 2
[name] => Test Patient
[age] => 44
[gender] => 0
[email] => emailid@gmail.com
[contact] => 789654123
[date] => 0000-00-00 00:00:00
)
[Test] => Array
(
[id] => 2
[name] => PCV
[group_id] => 1
[normal] => 35-50%
)
[Group] => Array
(
[id] => 1
[name] => Haematology
)
)
)
我需要它们按group\u id
或group.id
分组
我找不到它为什么没有分组。没有
$options = array
(
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
array(
'recursive'=>2,
'group'=>array('group_id')
)
);
但是
递归、条件和组处于同一级别
$options = array
(
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
array(
'recursive'=>2,
'group'=>array('group_id')
)
);
但是
递归、条件和组处于同一级别
$options = array
(
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
array(
'recursive'=>2,
'group'=>array('group_id')
)
);
但是
递归、条件和组处于同一级别
$options = array
(
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
array(
'recursive'=>2,
'group'=>array('group_id')
)
);
但是
递归、条件和组处于同一级别简单而甜蜜的代码:
$groupBy = 'Patient.group_id';
$options = array (
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
'group'=>array($groupBy)
);
简单而甜蜜的代码:
$groupBy = 'Patient.group_id';
$options = array (
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
'group'=>array($groupBy)
);
简单而甜蜜的代码:
$groupBy = 'Patient.group_id';
$options = array (
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
'group'=>array($groupBy)
);
简单而甜蜜的代码:
$groupBy = 'Patient.group_id';
$options = array (
'conditions' => array
(
'Patient.' . $this->Patient->primaryKey => $id
),
'group'=>array($groupBy)
);
+1用于通知错误。但是它没有根据组id对我的结果进行分组:(find()语句之后得到的sql是什么?+1用于通知错误。但是它没有根据组id对我的结果进行分组:(find()语句之后得到的sql是什么?+1用于通知错误。但是它没有根据组id对我的结果进行分组:(find()语句之后得到的sql是什么?+1用于通知错误。但它没有根据group_id对我的结果进行分组:(find()语句之后得到的sql是什么?