title: Laravel - Combine multiple queries as one and also include GroupBy
body: <p>I have written different queries that function for different things. I want to combine them as one (Sales for: Today, Current Week, Current Week, Current Month, Current Year and Overall Sales) and Group By a field called store.</p>
  
  <pre><code>            $currentYear = date('y');
          $currentyearbilling = DB::table("billings")
                 -&gt;select(DB::raw("SUM(amount) as total"))
                 -&gt;whereRaw('YEAR(created_at) = ?',$currentYear)
                 -&gt;get();
  
          $currentMonth = date('m');
          $currentmonthbilling = DB::table("billings")
                 -&gt;select(DB::raw("SUM(amount) as total"))
                 -&gt;whereRaw('MONTH(created_at) = ?',$currentMonth)
                 -&gt;get();
  
          $currentWeek = date('w');
          $currentweekbilling = DB::table("billings")
                 -&gt;select(DB::raw("SUM(amount) as total"))
                 -&gt;whereRaw('WEEK(created_at) = ?',$currentWeek)
                 -&gt;get();
  
          $currentDay = date('d');
          $currentdaybilling = DB::table("billings")
                 -&gt;select(DB::raw("SUM(amount) as total"))
                 -&gt;whereRaw('(created_at) = ?',$currentDay)
                 -&gt;get(); 
  </code></pre>
  
  <blockquote>
    <p>Group By store.</p>
  </blockquote>
  
  <p>The table name is called billings.  I still want to follow this format </p>
  
  <blockquote>
    <p>DB::table("billings")
    How do I achieve this?</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/i3ADw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i3ADw.png" alt="syntax error"></a></p>
  
  <p><strong>Error:</strong></p>