Home > OS >  Cancel group by from query in Laravel
Cancel group by from query in Laravel

Time:03-22

How can I cancel the "group by" clause in my query in Laravel?

For example I have:

$myQuery = Table::select('column')->groupBy('column');

And then later in my code I want to remove the group by clause from

$myQuery:$myQuery->groupBy(null);

CodePudding user response:

you can have 2 different variable to do it:

$base = Table::select('column');
withNoGroup= $base->get();
$withGroup = $base->groupby('column')->get();

CodePudding user response:

You can do it with:

$myQuery->groups = null;
  • Related