我的模型中有一个初始查询:
$query = Mymodel::where('is_active', 1);
我用它来得到不同的结果:
$result1 = $query->where('stat', null)->count();
$result2 = $query->where('stat', '!=', null)->count();
我的数据库中有4行,其中2行stat null,2行not null;所以我预计$result1和$result2的值是2;但我得到$result1是2,$result2是0;
就好像$result2查询有两个条件:null和notnull;