mysql - Laravel3 group_by + sum + paginate? -


i have write query : select azon, sum(points) points stats group azon; need paginate them in laravel3.

so tried stats::group_by('azon')->sum('points')->paginate(20);. of course did not work. tried

$stats2 = db::table('stats')                 ->select('azon', db::raw('sum(points) points'))                 ->group_by('azon')                 ->paginate(20); 

no results. last thing tried db::query('select azon, sum(points) points test_stats group azon') returns array , cannot paginate array. ideas, workarounds. hope laravel3 has this basic query.

the issue query is, select function in query builder accepts array parameter.

$stats2 = db::table('stats')     ->select( array( 'azon', db::raw('sum(points) points') ) )     ->group_by('azon')     ->paginate(20); 

Comments