CActiveDataProvider Row Count incorrect with 'Group by'

I have a CActiveDataprovider with $criteria->group and $criteria->having.

The ‘table’.count() eagerly action always remove ‘group by’ and ‘having’ when generate the sql, resulted in incorrect rowcount.

Is this a behavior of Yii or there is something I need to know?

Chung Chu

Is a bug.

There is a discussion here. I created a fix for this specific problem.

If you will check the page on googleCode, you will find a downloadable file ZDbConnection.php.

Download it, put in your protected folder and change your config/main to:




All will work correctly.