升级到8后,mysql错误,only_full_group_by错误

This line give me the error:

Error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'hng_1.tags.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

foreach($groups as $group)
    {
            $query = mysqli_query($verbindung, "SELECT * FROM (SELECT *, COUNT(id) AS c FROM tags WHERE typ='" . mysqli_real_escape_string($verbindung, $group) . "' GROUP BY slug ORDER BY c DESC LIMIT 9) AS i ORDER BY i.tag ASC") or die("Error: " . mysqli_error($verbindung));

            while ($row = mysqli_fetch_array($query)) {
                    $tmp_tags[] = $row;
            }
    }

How can I change the query to fix this error?

For anyone else who is interested, I solved this problem. I added id to GROUP BY so it now know what to select.

GROUP BY slug, id 

fix it.

8.0 之后,SQL_MODE 默认值改变了,具体修复错误的方法可看我写的这篇