[英]How to perform a WHERE NOT in Laravel with query build
Laravel query build has many where options, but I could not found a way to describe fields type timestamp
that are not null but have an invalid value. Laravel查询构建具有许多where选项,但是我找不到一种方法来描述类型为
timestamp
字段,这些字段不为null但具有无效值。 eg: 0000-00-00 00:00:00
例如:
0000-00-00 00:00:00
whereNull()
are not working since it is not null
whereNull()
不起作用,因为它not null
whereNot()
is treated as a invalid field not
whereNot()
被视为无效字段, not
I want to use the native MySQL query NOT field
since it match with "empty" values like 0000-00-00 00:00:00
我想使用本机MySQL查询
NOT field
因为它与“ empty”值匹配,如0000-00-00 00:00:00
Then, you will have to query it with IS NULL
option. 然后,您将不得不使用
IS NULL
选项查询它。 Check the ex : 检查前:
SELECT * FROM `tablename` WHERE `columnname` IS NULL LIMIT 0 , 30
See if the following helps 查看以下内容是否有帮助
$table->date('colname')->nullable();
$table->date('colname')->notnullable();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.