cgridview and relational database

i really need some help…

i have two tables which is

tbl_BookInfo:

id

title

author

tbl_in_out:

id

book_id

date_out

now the two already have a relationship where book_id in tbl_in_out belongs to BookInfo’s id.

what i want to happen is to query in tbl_in_out and diplay the record in cgridview with the corresponding records in the boookinfo table.

what i want to show in the columns in cgrid view will be:

|id|date out|title|author|

how can i achieve this… (sorry for the bad english, just comment if it is unclear)

something like


$dataProvider=new CActiveDataProvider('in_out', array(

    'criteria'=>array(

        'with'=>array('BookInfo_relation'),

    ),

));

…and then display $data->field

not tested