Home >Backend Development >PHP Tutorial >How to Fix Laravel's 'Syntax error or access violation: 1055 Error' with WhereIn and GroupBy?
In Laravel, combining WhereIn and GroupBy in a single query can sometimes lead to the "Syntax error or access violation: 1055 Error." This is because of a MySQL configuration setting called strict.
In the config/database.php file, you can disable all strict options by setting:
'mysql' => [ 'strict' => false ]
Instead of disabling all strict options, you can also selectively allow grouping by one column by adding the ONLY_FULL_GROUP_BY mode:
'mysql' => [ ... 'strict' => true, 'modes' => [ 'ONLY_FULL_GROUP_BY' ] ]
For a complete discussion on this issue, refer to the following answer:
[GitHub Issue: "Syntax error or access violation: 1055 Error" when Combining WhereIn and GroupBy](https://github.com/laravel/framework/issues/2981)
The above is the detailed content of How to Fix Laravel's 'Syntax error or access violation: 1055 Error' with WhereIn and GroupBy?. For more information, please follow other related articles on the PHP Chinese website!