left join not working

I can’t seem to get a left join working. I think the problem is in the relations, but I don’t quite understand it. The actual sql is as follows:

SELECT rantId, mp3, description FROM Topic left join Rant on Rant.topicId = Topic.topicId where Topic.licenseeId = 0 order by createDate desc

In my controller I have:

			$criteria=new CDbCriteria(array(



				'join' => 'LEFT JOIN Rant on t.topicId = Rant.topicId where t.licenseeId = '.$session["licenseeId"],

				'order'=>'createDate desc',


			$dataProvider=new CActiveDataProvider('Topic', array(






In my ‘Topic’ model I have the following:

	public function relations()


		return array(

			'rants' => array(self::BELONGS_TO, 'Rant', 'topicId'),

			'rant' => array(self::HAS_MANY, 'Rant', 'topicId'),

			'rantCount' => array(self::STAT, 'Rant', 'topicId'),



My view references the data as follows:


Can anyone point me in the right direction?

I’m confused. What is the actual relation between Topic and Rant?

I mean, "Topic belongs to Rant" or "Topic has many Rants"?

Could you summarize the table structures (PK and FKs) of the both?