How to get relational active recorde?

Hello everyone.I’m a newer using YII.Here is my problem as the title.Respect your’s help!TH’X :unsure: .

I create 2 table(mysql):product(InnoDB) and product_description(InnoDB),and they relative by product_id,when i get the data from product,it’s work,but when i get the data about them with the relational,it’s not work.Here is my code,respect your’s help,Thanks again!

class product extends CActiveRecord


public function relations()


return array(‘product_descriptions’ => array(self::HAS_MANY, ‘Product_Description’, ‘product_id’)));


function searchByKeyword()


$dataProvider = new CActiveDataProvider(‘Product’);

$criteria = new CDbCriteria();

$criteria->select = ‘t.ID,t.product_quantity,pd.product_name’;

$criteria->join = ‘LEFT JOIN product_description pd ON pd.product_id=t.ID’;

$criteria->condition = ‘pd.product_name= \‘IBM\’’;

$criteria->limit = 10;

$count = Product::model()->count($criteria);

$pages = new CPagination($count);



$dataProvider->criteria = $criteria;

return $dataProvider;




[exception.CDbException] exception ‘CDbException’ with message ‘Active record “product” is trying to select an invalid column “product_description.product_name”. Note, the column must exist in the table or be an expression with alias.’

Could you provide information on the structure of your two tables, product and product_description?

Thank’s for you focus it.

The table product data is base information of product;

And the table product_description data is multiple language infomation of product.

The table product_description is relative with product by the primary ID of product.

Th’x again.

Any body in?