我正在使用Laravel 5.5我添加了这个依赖项来制作简单的搜索引擎
https://github.com/nicolaslopezj/searchable
但在尝试搜索任何内容时遇到问题
SQLSTATE[42000]: Syntax error or access violation: 1055 'myreview.movies.name' isn't in GROUP BY (SQL: select count() as aggregate from (select movies., max((case when LOWER(movies.name) LIKE car then 150 else 0 end) + (case when LOWER(movies.name) LIKE car% then 50 else 0 end) + (case when LOWER(movies.name) LIKE %car% then 10 else 0 end) + (case when LOWER(movies.description) LIKE car then 150 else 0 end) + (case when LOWER(movies.description) LIKE car% then 50 else 0 end)
我已经尝试过改变mysql数据库 我改用mysql 5.7后使用mariadb 10.2工作正常
但我的cpanel服务器上有mariadb
帮我看看这个 谢谢
答案 0 :(得分:4)
将值严格从true更改为false
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
保存
你可以在我的帖子中读完=> How to Fix SQLSTATE[42000]: Syntax error or access violation: 1055
答案 1 :(得分:0)
查询失败的SQL原因是只能在使用聚合函数的SQL语句的SELECT子句中使用GROUP BY子句中出现的列。 SO post中接受的答案充分说明了这一点。