I have database relation as follows between question table and Hardware detail table.
Question and HardwareDetail has many to many relation. and tbl_quesionhardwaredetial table holds another new property called answer
I want to create active data provider (CActiveDataProvider) with list of questions and relevant answers for a given hardware detail.
I have pull relevant questions for a given hardware detail using following criteria.
$quesionsDataProvider=new CActiveDataProvider('Question', array(
'criteria'=>array(
'with'=>array('hardwaredetails'=>array(
'on'=>'hardwaredetail_Id=' .$modelHD->Id,
'together'=>true,
'joinType'=>'INNER JOIN',
)),
),
'pagination'=>array(
'pageSize'=>10,
),
));
But how can i attach the answer to the list of questions retrieved.
Thanks in advance for any help
. 
Instead of creating CActiveDataProvider you can create CSqlDataProvider which is more flexible and you can write sql queries by hand
Example:
$qry = your sql query for selecting records
$count = no of records(you should modify above $qry to find record count)
‘keyField’= you should mention keyField, if you use different primary key field other than ‘id’
further reading CSqlDataProvider