Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT Event.id, sum(Attendees.total_raised), sum(Attendees.total_hours)
- FROM Events JOIN Attendees ON Events.id = Attendees.event_id
- GROUP BY Event.id
- $q = DB::table('events')
- ->join('attendees', 'events.id', '=', 'attendees.event_id')
- ->sum('total_raised')
- ->sum('total_hours');
- ...
- ->get(
- array(
- 'events.id',
- DB::raw('SUM(attendees.total_raised)'),
- DB::raw('SUM(attendees.total_hours)')
- )
- );
- $query = DB::table('events')->join('attendees', 'events.id', '=', 'attendees.event_id');
- $raised = $query->sum( 'total_raised' );
- $hours = $query->sum( 'total_hours' );
- $result = DB::table('events')->join('attendees', 'events.id', '=', 'attendees.event_id')
- ->get( array(
- DB::raw( 'SUM(attendees.total_raised) AS raised' ),
- DB::raw( 'SUM(attendees.total_hours) AS hours' ),
- ));
- $result = self::select("*", DB::raw('SUM(auction_amount) as total_auction_amount') , DB::raw('SUM(commission_amount) as total_commission_amount'),
- DB::raw('SUM(deposit_amount) as total_deposit_amount'))
- ->groupBy('cp_user_id')
- ->get()
- ->toArray();
- $result = self::select("*", DB::raw('SUM(auction_amount) as total_auction_amount') , DB::raw('SUM(Attendees.total_raised) as total_raised'),
- DB::raw('SUM(Attendees.total_hours) as total_hours'))
- ->with('Attendees')
- ->groupBy('id')
- ->get()
- ->toArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement