I am using Laravel 5.6
and SQLite
I am trying to return certain results between a time frame. The problem is that when I add a whereBetween
clause on the created_at
column it is missing results. created_at
is of type DateTime
This query should return two results. I am grouping by c_sub_category
and there are only two c_sub_categories
but currently it is returning just 1 result
$data = Tickets
::whereBetween('created_at', [$week["startDate"], $week["endDate"]])
->where('status', 'closed')
->where('category', '!=', 'New Development')
->groupBy('c_sub_category')
->get();
This query without the whereBetween
clause returning two results which is correct
$data = Tickets
->where('status', 'closed')
->where('category', '!=', 'New Development')
->groupBy('c_sub_category')
->get();
Other ways I have tried that also don't return the correct result set
$data = Tickets
::where(function ($query) use ($week) {
$query->whereBetween('created_at', [$week["startDate"], $week["endDate"]]);
})
->where('category', '!=', 'New Development')
->where('status', 'closed')
->groupBy('c_sub_category')
->get();
$data = Tickets
::where(function ($query) use ($week) {
$query->whereBetween('created_at', [$week["startDate"], $week["endDate"]]);
})
->where(function ($query) use ($week) {
$query->where('category', '!=', 'New Development');
->where('status', 'closed');
})
->groupBy('c_sub_category')
->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire