我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

too long

Based on the code below, I want to update all in customer to status 1 where status = 2. However, i want to run the code below where customer_id not in (1, 3, 5, 8).

$customerNotIn = array(1, 3, 5 ,8);
Customer::updateAll(['status' => 1], 'status = 2');

How can i achieve that?

The condition can be in the format of what you'd put in a ->where(), so in your case would be:

$customerNotIn = array(1, 3, 5 ,8);
Customer::updateAll(['status' => 1], ['AND', 
    'status = 2', 
    ['NOT IN', 'status', $customerNotIn]
]);

近期文章

  • django中如何通过js实现翻页后仍然保持复选框的勾选状态
  • 鼎信诺安装过程中遇到的问题
  • 如何使用T1,完成下面的任务
  • keil以前显示missing complier version5装了之后变成了这样。有没人能帮助一下。
  • 报错功能名称与拟合期间传递的名称不匹配
  • equals判断Button有什么不同吗
  • 显示跨域问题问题照片,如何解决?
  • 电脑显示user profile service服务登录失败 无法登录
  • 寻找n以内符合特定条件的素数。各位之和依然为素数的数
  • Adams2020版软件安装
  • 使用php将空子添加到xml
  • stata分组生成新变量
  • codeblock显示:cannot open output file bin\Debug\仓库货物管理系统(block).exe Permission denied
  • 求解Python操作题
  • proteus使用芯片时需要输入用户名和密码 怎么解决
  • 斐波那契数列python
  • yolov5s目标检测问题
  • postman接口测试扫码登录
  • matplotlib子图排列问题?
  • 使用一个按钮上传PHP图像

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华