Hey everyone,
I would like to display something like:
Group 1 Header
data for group 1
Group 2 Header
data for group 2
Applying the distinct to the SQL query would leave me without detailed data. So, is there a function in Yii like
$model->getDistinctValues('group')
to extract the distinct values after the query?
As an alternative only a 2nd query comes into my mind :-(
Page 1 of 1
how to find distinct values in array?
#2
Posted 08 January 2010 - 09:59 AM
steffen, on 08 January 2010 - 08:46 AM, said:
Hey everyone,
I would like to display something like:
Group 1 Header
data for group 1
Group 2 Header
data for group 2
Applying the distinct to the SQL query would leave me without detailed data. So, is there a function in Yii like
$model->getDistinctValues('group')
to extract the distinct values after the query?
As an alternative only a 2nd query comes into my mind :-(
I would like to display something like:
Group 1 Header
data for group 1
Group 2 Header
data for group 2
Applying the distinct to the SQL query would leave me without detailed data. So, is there a function in Yii like
$model->getDistinctValues('group')
to extract the distinct values after the query?
As an alternative only a 2nd query comes into my mind :-(
Sorry. I'm mistaken
$criteria->distinct=true;
http://www.yiiframew...dpost&pid=33101
This post has been edited by Horacio Segura: 08 January 2010 - 10:03 AM
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
http://hmsegura.blogspot.com/
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
http://hmsegura.blogspot.com/
#3
Posted 08 January 2010 - 10:09 AM
try this
in the controler
and in the view
in the controler
$models=TableGroup::model()->with('detail')->findAll();
and in the view
<?php foreach($models as $model):?>
...
<?php foreach($model->detail as $detail):?>
...
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
http://hmsegura.blogspot.com/
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
http://hmsegura.blogspot.com/
Share this topic:
Page 1 of 1

Help












