count number of records

I can not display total number of data. I have one field, name "record", I want to display total records. Can any one help me?

This is my view file

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(

'dataProvider'=&gt;&#036;dataProvider,


'columns'=&gt;array(


	'id',


	'name',


	[b]'records_id',[/b]


	'note',


	


),

)); ?>

Controller

public function actionView()

{


	&#036;dataProvider=new CActiveDataProvider('info', array(


		'criteria'=&gt;array(


		'condition'=&gt;'User_id =' .Yii::app()-&gt;user-&gt;id,


		),


		


		'pagination'=&gt;array(


			'pageSize'=&gt;self::PAGE_SIZE,


		),


	));





	&#036;this-&gt;render('view',array(


		'dataProvider'=&gt;&#036;dataProvider,


	));


}

This is my sql command

SELECT count( records_id ) FROM info WHERE records_id IS NOT NULL AND User_id = 12 GROUP BY records_id


echo $dataProvider->getTotalItemCount();

I don’t want total records. I need SUM(records_id) field with group by . THis is my SQL command

SELECT count(records_id ) FROM info WHERE records_id IS NOT NULL AND User_id = 12 GROUP BY records_id

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(

‘dataProvider’=>$dataProvider,

‘columns’=>array(

‘id’,

‘name’,

‘records_id’,

‘note’,

),

)); ?>

Sorry. I just can’t understand what you’re asking. :(

Sorry about my english. Actually I want to count record_id field if record_id IS NOT NULL

I think you can do this with


Info::model()->count($condition);

putting your WHERE clause into $condition, either as a string or an array to initialize a CDbCriteria.