PostgreSQL Group by & Order By

Hi, i ask for help, did someone knows how to work with the criteria of group by and order by with postgresql database.

$fechas = Detenido::model()->findAll(array('order' => 'fecha','group'=>'fecha'));

i have the next error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42803]: Grouping error: 7 ERROR: la columna «t.gid» debe aparecer en la cláusula GROUP BY o ser usada en una función de agregación

please, any help will be welcome. :slight_smile: