#GroupBy query based from 'from' and 'to' dates
6 messages · Page 1 of 1 (latest)
Use whereBetween to get the date range and then group by date
Model::whereBetween($from,$to)->groupBy(“date”)->get()
I think you misread the question. There are 2 date columns.
AFAIK there's no easy way to do this with a query. I think you'd have to join a query where you generate the intermediate dates manually. It'd be much easier to in PHP if you have that option.
What operation you are planning to do with the group by (SUM, AVG?). If you have one row and two dates, and you want to group by days in that period, how do you want to split the target attribute?