Include column name when updating record

Hello all,

I use updateAll() to update records




$scc = $sccValue / count($model);

					

$this->updateAll(

	array(

		'cost'=>'cost - ' .$scc,

		'scc_percent'=>0

	), 

	'bid_id = :bid_id', 

	array(

		'bid_id'=>$bidId

	)

);



but the generated SQL become something like this (binding parameters are omitted):




UPDATE bid_detail SET cost=’cost-10’ WHERE …



which produces incorrect result. I expect it can be like this:




UPDATE bid_detail SET cost=cost-10 WHERE …



How can this be achieved if we want to use updateAll()?

Thank you in advance.

CDbExpression is what you need.




$model->updateAll(

	array('cost' => new CDbExpression('cost - ' . $scc))

);



Works great. Thanks for the quick reply, phtamas.