Laravel Eloquent “WHERE NOT IN" [英] Laravel Eloquent "WHERE NOT IN"

查看:26
本文介绍了Laravel Eloquent “WHERE NOT IN"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 laravel eloquent ORM 中编写查询时遇到问题.

I'm having trouble to write query in laravel eloquent ORM.

我的查询是

SELECT book_name,dt_of_pub,pub_lang,no_page,book_price  
FROM book_mast        
WHERE book_price NOT IN (100,200);

现在我想把这个查询转换成 Laravel eloquent.

Now I want to convert this query into laravel eloquent.

推荐答案

查询生成器:

DB::table(..)->select(..)->whereNotIn('book_price', [100,200])->get();

雄辩:

SomeModel::select(..)->whereNotIn('book_price', [100,200])->get();

这篇关于Laravel Eloquent “WHERE NOT IN"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆