Cgridview invalid pagination and Count Summary

Hi,

I have a table contain posters of different users. Currently I have 20 records thats working fine.

Then i used distinct with user id, grid result showing only five records that is currect. but the issue is the pagination showing second and count showing 20 records

My code snippet is comes here





	$criteria=new NewCDbCriteria;


		$criteria->compare('id',$this->id);

		$criteria->compare('UserId',$this->UserId);

		$criteria->distinct=true;

		$criteria->select='UserId';

		$datProvider = new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

		));




Try with




$criteria->group = 'UserId';



Yes now its working :). But distinct showing error count, that is isssue