Update with WHERE IN clause in CakePHP

邮差的信 提交于 2019-12-24 07:45:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!