group by之后的按语句排序在cpanel中不起作用,但在localhost中起作用

当我将其上传到在线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)

在我使用的控制器中

        $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 It was my expectation

but without ordering i get this one without ordering

请查看图片中的标签,然后您将得到错误。现在,我想知道在cpanel中上传项目时如何按ID或类进行订购。