yiisoft/yii — pull request #354 by DaSourcerer (2012-02-17 12:20:30+00:00)
Title: Issue #124 

New attempt: The Command builder will construct update queries that do not take MySQLs needs into account when joins are being involved.

An example from the blog demo:

Post::model()->updateAll(array(
'content'=>'m00',
), array(
'join'=>'JOIN {{user}} u ON `author_id`=u.`id`',
'condition'=>'u.`username`="demo"',
));

This will produce a query like this:
UPDATE table SET column='value' JOIN table2 ON id=id2
```UPDATE `tbl_post` SET `content`=:yp0 JOIN tbl_user u ON `author_id`=u.`id` WHERE u.`username`="demo";```
But MySQL expects the query to be like this:
```UPDATE `tbl_post` JOIN tbl_user u ON `author_id` = u.`id` SET `content`=:yp0 WHERE u.`username`="demo";```

See:
* http://dev.mysql.com/doc/refman/5.1/en/update.html
* http://dev.mysql.com/doc/refman/5.1/en/join.html