Php Laravel 5.1其中NOTNULL与连接不工作(返回所有数据)
我正在尝试选择“user”表中列名为“review”的所有非空列Php Laravel 5.1其中NOTNULL与连接不工作(返回所有数据),php,mysql,laravel-4,eloquent,laravel-5,Php,Mysql,Laravel 4,Eloquent,Laravel 5,我正在尝试选择“user”表中列名为“review”的所有非空列 $applications = DB::table('users') ->join('applications', 'user.update_id', '=', 'applications.id') ->whereNotNull('users.review') ->select('user.id', 'user.rating', 'user.appid', 'user.review', '
$applications = DB::table('users')
->join('applications', 'user.update_id', '=', 'applications.id')
->whereNotNull('users.review')
->select('user.id', 'user.rating', 'user.appid', 'user.review', 'applications.title', 'applications.price', 'applications.icon_uri')
->orderBy('user.id','asc')
->paginate(20);
$applications->setPath('');
return $applications;
但返回数据包括“user.review”和“not empty”的所有信息
我觉得whereNotNull()
没有任何影响,我在语句中没有发现任何错误
我尝试移动->whereNotNull('user.review')
这一行的顶部和底部结果是相同的
我甚至尝试删除select和orderBy,但返回相同的数据
$applications = DB::table('users')
->join('applications', 'user.update_id', '=', 'applications.id')
->whereNotNull('users.review')
->paginate(20);
$applications->setPath('');
return $applications;
有什么方法可以让它工作吗?如果您的表是用户您在表名中缺少一个s,您应该写
->whereNotNull('users.review')
与字段update_id的联接中的情况相同,否则必须在table方法中更改表名no这不是问题所在。我再次编辑了问题。数据库中的列确实有空值或只是空的?这是有效的,因为只有问题行是空的。数据库中不是空的