title: Laravel Query Builder with sum
body: <p>below is the query , and i am having this error</p>
  
  <p>SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax</p>
  
  <pre><code>        $games = DB::table('games')
          -&gt;select('start','dayofweek','name','ins_id','location_id',
              DB::raw('SUM(reservations) as reservations'),
              DB::raw('SUM(reservationsmax) as reservationsmax'),
              DB::raw('SUM(entries) as entries'),
              DB::raw('SUM(entriesmax) as entriesmax'),
              DB::raw('(SUM(entries) / SUM(reservationsmax) * 100 as percentage'))
          -&gt;where('club_id', $club_id)
          -&gt;whereBetween('start', [$from, $to])
          -&gt;where('hide_from_customers', 0)
          -&gt;where('external_id', 0)
          -&gt;orderBy('name')
          -&gt;groupBy('start')
          -&gt;groupBy('dayofweek')
          -&gt;groupBy('name')
          -&gt;get();
  </code></pre>