How to GROUP BY multiple column in Laravel? I tried this code:
GROUP BY
$routes = DB::table('route') ->groupBy('rte_origin') ->groupBy('rte_destination') ->get();
But this is not working.
Did you try:
$routes = DB::table('route') ->groupBy('rte_origin', 'rte_destination') ->get();
Can't test here right now, but the API says groupBy() accepts an array.
For reference, please visit:
1.4m articles
1.4m replys
5 comments
57.0k users