Level 61
It would be nice to have vote powered guides.
2 likes
I see many questions come up with the error:
SELECT list is not in GROUP BY clause and contains nonaggregated column .......
Many answers are telling the poster to change strict mode from true to false in the database config file.
But you can just do this for one query only by adding before the query:
config()->set('database.connections.your_connection.strict', false);
// change your_connection to actual connection name.
// then run your query
For example If the connection you need it on is mysql then:
config()->set('database.connections.mysql.strict', false);
That way if only needed for one query no need to change it in config/database.php
Please or to participate in this conversation.