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:
2.1m questions
2.1m answers
60 comments
57.0k users