Query Builder and CListView

Is it possible to use the data returned by a query, that was builed using the Query Builder funtion, in a CListView?

it would be nice to use the pagaing and stuff of the CListView…

You need a dataProvider, so you can use the CSqlDataProvider

$sql = Yii::app()->db->createCommand()




$count=Yii::app()->db->createCommand('SELECT COUNT(*) FROM tbl_user')->queryScalar();

$dataProvider=new CSqlDataProvider($sql, array(




             'id', 'username', 'email',







//render the view with the CListView