Issue
Scenario:
The startdate
and enddata
in the database is 2015-07-20
and 2015-07-30
respectively and the query that works properly is,
Model::whereBetween('startdate',array('2015-07-30','2015-08-10'))->get();
The query return 1 record from the table which is the expected result. Now what I expect is a slight change. The query should not retrieve the record by considering the date 2015-07-30
does not fall in between 2015-07-30
. How do I achieve this?
Solution
whereBetween is inclusive. In order to exclude one of the edges you'll need to build a between query manually:
Model::where('startdate', '>', '2015-07-30')->where('startdate', '<=', '2015-08-10')->get();
Answered By - jedrzej.kurylo
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.