Ich habe die folgende Abfrage:MySQL-Abfrage läuft in phpMyAdmin, nicht in Laravel
SELECT a.*, Count(b.status) as counttotal
FROM holidays a LEFT JOIN attendances b
on a.month_id=b.month_id
GROUP BY a.month_id
Diese Abfrage führt erfolgreich in phpMyAdmin.
Als ich versuchte, die gleiche Abfrage durch php artisan tinker
zu laufen, ich folgende Fehlermeldung erhalten:
Illuminate\Database\QueryException with message 'SQLSTATE[42000]: Syntax error or access violation: 1055 'school_blog.a.month' isn't in GROUP BY (SQL: SELECT a.*, Count(b.status) as counttotal FROM holidays a LEFT JOIN attendances b on a.month_id=b.month_id GROUP BY a.month_id)'
Wie behebe ich das?
[Dies] (https://stackoverflow.com/a/42747612/899126) kann Ihr Problem lösen –