Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何添加where列值!='查询中的“试验”_Php_Mysql_Laravel_Select_Where Clause - Fatal编程技术网

Php 如何添加where列值!='查询中的“试验”

Php 如何添加where列值!='查询中的“试验”,php,mysql,laravel,select,where-clause,Php,Mysql,Laravel,Select,Where Clause,我面临一个查询问题,问题是我想选择一个值,其中包含另一列值!=审判,我无法做到这一点,请帮助我 我的问题是: $datestart = \DB::table('subscriptions')->where('business_id', $business_id,'payment_transaction_id,""')->Orderby('id','desc')->value('start_date'); 您需要使用运算符 您可以使用“!=”但是它忽略了空记录,所以使用“!=”

我面临一个查询问题,问题是我想选择一个值,其中包含另一列值!=审判,我无法做到这一点,请帮助我

我的问题是:

$datestart = \DB::table('subscriptions')->where('business_id', $business_id,'payment_transaction_id,""')->Orderby('id','desc')->value('start_date');
您需要使用运算符


您可以使用“!=”但是它忽略了空记录,所以使用“!=”这个

Model::where('column_name', '!=' ,'value')->orWhereNull('value')->get();

所以使用此运算符是安全的,因为字段不为空

Model::where('column_name', '<>' ,'value')->get();

你需要这个接线员在哪里


来自评论:嗨,这篇文章似乎并没有为这个问题提供答案。请编辑您的答案并加以改进,或者将其作为评论发布。$datestart=\DB::table'subscriptions'->where'business\u id',$business\u id->WhereNotIn'payment\u transaction\u id','Trial'->Orderby'id','desc'->value'start\u date';还是没有working@digisoft使用where,而不是WhereNotIn$datestart=\DB::table'subscriptions'->where'business\u id',$business\u id->WhereNotIn'payment\u transaction\u id','Trial'->Orderby'id','desc'->value'start\u date';仍然不工作–只需使用where而不是whereNotIn whereNotIn方法验证给定数组中不包含给定列的值。和之间没有区别!=在MySQL中,付款交易id是否可以为空?如果是的话,您想在它被选中时选择它吗?
Model::where('column_name', '<>' ,'value')->get();

...->where('column_name', '<>' ,'value')->...