-1

I disable "only_full_group_by" on mysql but "laravel" giving above error

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'answer_reactions.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from `answer_reactions` where `answer_reactions`.`answer_id` in (147, 156, 165) group by `answer_reactions`.`type`)
Rev Tech
  • 63
  • 10
  • how did you disable it ? in database.php strict ? anyway, i dont recommend you to do so. you should explain more what you are trying to get as a result and we will help you with it, especially with strict mode active. – N69S Jul 29 '19 at 13:04
  • The following question and its answers are better than those on this page. https://stackoverflow.com/a/41145619/470749 – Ryan Jun 14 '21 at 00:55

2 Answers2

9

in Laravel config\database.php file, inside the mysql driver array add 'strict' => false, and give it a try.

Theekshana
  • 417
  • 4
  • 8
0

Test with:

GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Tany
  • 1
  • 1