问题
I'm trying to update multiple records in the database with the same value. Is it possible to have WHERE IN('1','2','3','4','5' ...);
kind of query or maybe WHERE id = 1 OR id = 2 ...
so that this can happen quickly.
I'm currently trying to update 130 rows with the same value using saveAll
and it's pretty slow.
回答1:
Have you tried updateAll ?
$this->updateAll(
array(
// new values
),
array('id' => array(1,2,3,4,5,6))
);
来源:https://stackoverflow.com/questions/22068164/update-with-where-in-clause-in-cakephp