That's because any column you use in a select statement must appear in the group by clause. So select * and group by don't get along.
Remove groupBy('cardid') in your relationship and see how that goes.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
what does this error mean, how can i fix it?
QueryException in Connection.php line 761:
SQLSTATE[42000]: Syntax error or access violation: 1055 'd0170cbc.tcg_deck_cards.id' isn't in GROUP BY (SQL: select * from `tcg_deck_cards` where `tcg_deck_cards`.`deckid` in (862) group by `cardid` order by `amount` desc)
Controller
$deck = Deck::with('Cards.Card.Edition')
->where('id', '=', $deckid)
->first();
return $deck;
DeckModel
public function Cards() {
return $this->hasMany('App\Models\Pokemon_TCG\Deck\DeckCards', 'deckid')
->groupBy('cardid')
->orderBy('amount', 'desc');
}
Thank You
Please or to participate in this conversation.