i get this error when i upload it on online cpanel
Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'dreamsch_school_management.students.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select class
, count(*) as total from students
group by class
order by id
asc)
in controller i Used
$groups = DB::table('students')
->select('class', DB::raw('count(*) as total'))
->groupBy('class')
->orderBy('id', 'ASC')
->get();
i want to arrange in assending order by class. in bar chart. but it give error in order by
line but correctly runs in my localhost. can you please help me with the query.
It was my expectation
but without ordering i get this one
Please see the labels in the pictures then you can get the errors. now I want to know how can I place ordering by ID or class when I upload my project in cpanel.