Hello everyone, I have some problems with the new version of SQL, which uses the only_full_group_by option. I have two tables: sensor and data. The sensor table HAS_MANY data, so the data table has a foreignkey to the pk of sensor table. Here is one relation:
'avg' => array(self::HAS_MANY, 'Data', 'sensor_id', 'select' => 'AVG(value) AS avg, date AS date', 'group' => 'date', 'order' => 'date desc')
Yii is complaining because there is a column in the SELECT statement that is not aggrgated. This column is the pk of the data table, which seems to be automatically added in the select of the generated query, in fact the query is:
SELECT AVG(value) AS avg, date as date, id_data FROM `data` `avg` WHERE ... GROUP BY date ORDER ...
What I want to do is to remove the added pk or wrap it with ANY_VALUE, so that the only_full_group_by option does not complain anymore.