2
我真的上,可以在13种阳性情况写日期范围重叠的功能工作,以检查日期时间间隔重叠:锋MYSQL语句:WHERE NOT(A或B)
https://en.wikipedia.org/wiki/Allen%27s_interval_algebra
或更优雅2分负的条件:
http://baodad.blogspot.nl/2014/06/date-range-overlap.html
在MYSQL:
WHERE NOT(`last_day` <= '2001-06-01' OR `first_day` >= '2022-12-01');
这需要这样的事情,我不能老是在文档发现:
$query = $query->whereNot(function ($query) use ($first_day, $last_day) {
$query->where('last_day', '<=', $first_day);
$query->orWhere('first_day', '<=', $last_day);
});
我怎样才能解决这个问题?
这关系到我的其他可能的复制帖子:Laravel/Eloquent WHERE NOT SUBQUERY
但我希望我的问题是更清晰了。