2
に私が書かれていません生のクエリは、phpMyAdminの上で動作しますが、laravel
LaravelでSELECT customers.customer_name, customers.voucher_number ,
services.name, customers.status,sum(carts.amount) FROM services JOIN customers
on services.id = customers.service_id JOIN carts on customers.id = carts.customer_id
GROUP BY customers.id
:
$status_report = DB::select("SELECT customers.customer_name, customers.voucher_number ,
services.name, customers.status,sum(carts.amount) FROM services JOIN customers
on services.id = customers.service_id JOIN carts on customers.id = carts.customer_id
GROUP BY customers.id");
何の可能なエラーをだろうか?あなたの生のSQLをラップするDB::raw
を使用する必要が
SQLSTATE[42000]: Syntax error or access violation: 1055 'maitree.customers.customer_name' isn't in GROUP BY (SQL: SELECT customers.customer_name, customers.voucher_number ,
services.name, customers.status,sum(carts.amount) FROM services JOIN customers
on services.id = customers.service_id JOIN carts on customers.id = carts.customer_id
GROUP BY services.id)
DB :: rawも使用しましたが、出力が得られませんでした。 – Hola