Jun 9, 2016
0
Level 1
GroupBy date - same month different year
Hi
I have a timesheet application where I registrate working hours each day. I started using it in June 2015. I have a view on the application where I can choose (from a dropdown) month and display the days and hours I have worked that given month. Now when I want to view my worked hours in June 2016 i am not able to choose this from my dropdown list. The problem is in the groupBy, but I can't seem to find a working solution. I appreciate any help.
This is where I get my selection for the select dropdown.
/*
* Delivers the list of months for the dropdown
*/
$alle = DB::table('timesheet')->selectRaw("DATE_FORMAT(date,'%Y-%m-%d') as date, DATE_FORMAT(date,'%M %Y') as dateshow")
->orderBy(DB::raw("YEAR(date)","MONTH(date)"))
->groupBy(DB::raw("MONTH(date)"))
->simplePaginate(20);
Please or to participate in this conversation.