Massive Updates/inserts Like Insert ... Select

Hi All,

Is there any other way to perform something like this in Yii or is this the best approach?




$query = 'UPDATE cause c

             SET status = 8

           WHERE c.type = 2

             AND (c.status = 2 OR c.status = 3 OR c.status = 4)

             AND c.max > (SELECT IFNULL(SUM(d.amount),0) FROM amounts d WHERE d.cause_id = c.id)

             AND c.end_time < UNIX_TIMESTAMP()';

Yii::app()->createCommand($query)->execute();



Thanks!