Findall Using Right Join

Hello everyone! this is my first post, hope doing it right

After long research, I cant explain whats wrong with my situation

I have two tables (2 models) and I am trying to do a RIGHT JOIN query.

In mysql, it brings for example

Suppose ‘name’ is from one table and ‘value’ is from the other table.

name - value

null - 1

test2 - 2

null - 3

this is fine because I need every value, even if it has or not a name.



FROM table1 as t1

RIGHT JOIN table2 as t2

ON =

The problem comes when I try to do it in Yii.

$criteria = new CDbCriteria();



              "joinType"=>"RIGHT JOIN",



$models = Table1::model()->findAll($criteria);

foreach ($models as $model) {

    echo $model->name . ' - ' . $model->t2relation->value . '<br />';


And it only shows

test2 - 2

Apparently, if the name is null (no exists an row in the table1 for each row at table2), it doesnt come as a model. I was thinking if it was because no primary key or something.

I tried otherwise (from table2 to table1) and that still happens.

I want to have that as models, not through sqlcommand (because then I dont know how to use it as easy as models, instead, I have to see how to put it in array and in view, its going to be different access from other code)

Hope you can help me and understand my not well english :)

Thanks in advanced

After research, I found it was a bug issue reported here:

ISSUE: 3222 on http:\\ dot com \ p \ yii \ issues / detail?id=3222

as I am a new forum user, I cannot type urls, but you understand :)

I did what the solution says and I am getting one more row (or model), but 2 more models left (the query of CWebLogRout - EnableFrofiling brings all the rows I am not getting but supposed to).

If somebody could help me please. I realy need a hand