Join Two Table Using Only Foreign Keys

Well suppose i have three table

User (PK : user_id)

Suggestion (PK : suggestion_id, FK : user_id )

UserRate (PK : user_rate, FK : user_id)

Now how can i join tables Suggestion and UserRate using Relation method

i am doing like

public function relations()


return array(

‘user’ => array(self::BELONGS_TO, ‘User’, ‘user_id’),




Here How to join Table Suggestion to UserRate with foreign key user_id ???


Using the following MySQL query you can execute the tables in database

[sql]SELECT * FROM Suggestion


ON Suggestion.user_id = UserRate.user_id;[/sql]

And i have no idea about how to execute the same in the YII. The same I’m also struggled. If you find any solution please help me…

ok, i will tell you when i will get the solution :)