Joining 2 Tables

can anybody help me to join 2 tables.

i have tbl_a(id, name) and tbl_ab(temp, uid, born)

in tbl_a, id is primary key,

in tbl_b, temp is primary key

and uid is foreignkey which refers id oftbl_a.

i have my code like,

public function relations()


	// NOTE: you may need to adjust the relation name and the related

	// class name for the relations automatically generated below.

	return array(

		'id' => array(self::BELONGS_TO, 'tbl_one', 'id'),

		'name' => array(self::BELONGS_TO, 'tbl_one', 'name'),



here tbl_one is my model name of table tbl_a

in view/admin i written like

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







array('name'=&gt;'id',  'value'=&gt;'&#036;data-&gt;tbl_one-&gt;id'),  

    array('name'=&gt;'name',  'value'=&gt;'&#036;data-&gt;tbl_one-&gt;name'), 









)); ?>

and in tbl_two.php(model) i have search function like

public function search()


	// Warning: Please modify the following code to remove attributes that

	// should not be searched.

	&#036;criteria=new CDbCriteria;

	&#036;criteria-&gt;alias = 'i';




	&#036;criteria-&gt;join= 'JOIN tbl_ab d ON (i.uid=d.uid)';

	return new CActiveDataProvider(&#036;this, array(




i am not getting the output. getting error like:

Property "tbl_two.tbl_one" is not defined.

can anybody help me to resolve this plz soon…

You seem to have misunderstood relations. You should read through this section of the guide.

had given proper relationship…,