Searching relational models

I am somewhat new to MySQL and am learning it through yii CDBCriteria and CDataProvider.

In searching across two relational models, it took me some time to find out that I needed to ID the first model with ‘t.attribute’.

$criteria->compare(‘t.title’, $model->attributes[title], $partialMatch=true);

Could someone recommend documentation I should go back and study in regard to DB functions? Will I see "t.attribute" explained in it?

Thank you,

Peter

Hi!

Try check here

That’s it. Thank you. I missed that as I read thru that doc. Okay. Thank you. For others, here’ the error you see:

CDbCommand failed… Integrity constraint violation: 1052 Column ‘attribute-name’ in where clause is ambiguous.

now I am trying to figure out why the relational DB attributes disappear on subsequent searches while the t. fields remain.

I am all in on yii and hope to help many others thru the years.