how to find distinct values in array?

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 :frowning:

Sorry. I’m mistaken

for distinct use

[s]

$criteria->distinct=true;

[/s]

[s]for group see

http://www.yiiframew…dpost&pid=33101

[/s]

try this

in the controler




       $models=TableGroup::model()->with('detail')->findAll();



and in the view




<?php foreach($models as $model):?>

...

     <?php foreach($model->detail as $detail):?>

      ...