如何放置'!='在Laravel查询构建器中有一个数组?
在Laravel查询构建器中,我如何编写不平等?
我想这样查询 例如,
从表中选择 *!
$removeIdListArray = (1,2,4,6);
$removedIdList = Stack::
->where('columnA',$removeIdListArray);
//↑What should I do?
How can I write not equal in where in laravel query builder ?
I would like to query like this
e.g.
select * from Table where a != '1' and a != '2' and a != '4' and a != '6' ;
$removeIdListArray = (1,2,4,6);
$removedIdList = Stack::
->where('columnA',$removeIdListArray);
//↑What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
wherenotin
并将数组作为第二个参数参考:数据库:查询构建器
You can use
whereNotIn
and pass an array as the second parameterReference: Database: Query Builder
最流利的方式:
我建议您始终将Query()方法与模型一起使用,因为它可以探索Laravel模型类的所有可用选项
The most fluent way :
I will recommend you always using query() method together with your models, since it will allow you to explore all of the available options for the Laravel Model class
简单:
或
Simply :
or