Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I group by multiple parameters using CDbCriteria in Yii?

Tags:

yii

Currently I have a criteria as shown below which finds average of column1 in my base table while joining with table1 and table2.

    $criteria= new CDbCriteria;
    $criteria->select = 'AVG(t.column1) as cc';
    $criteria->group = 'table1.id';
    $criteria->with = array('table1', 'table2');

How do I group by tabel1.id as well as table2.id in the above criteria?

like image 255
uglypointer Avatar asked Oct 31 '22 21:10

uglypointer


1 Answers

seperate them by ,

   $criteria->group = 'table1.id , table2.id';
like image 197
Developerium Avatar answered Dec 08 '22 22:12

Developerium