I have to tables, one is profile
and the other is rating
.
rating
has a field profileid
which is primary key to profile.id
and a field with rating values. Now I want to find the field with highest rating and display the corresponding profile. Since I m new to YII framework I m having troubles with it. Please help me getting out of it. What I m doing is described below.
$topRage=new CDbCriteria();
$topRage->select="*";
$topRage->alias="t1";
$topRage->order="rateing DESC";
$topRage->join="JOIN `ratings` ON `profile`.`id` = `t1`.`profileId`";
$topRage->limit="1";